Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp439468ybl; Thu, 5 Dec 2019 23:58:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyiq8onQxMEas6cWAaLTYKjaxYo5IKlUQUfC07dSWy7ErJLOionOruIkE7wWCEti8FfpCMk X-Received: by 2002:aca:bb08:: with SMTP id l8mr42360oif.47.1575619120022; Thu, 05 Dec 2019 23:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575619120; cv=none; d=google.com; s=arc-20160816; b=HSiGlO0kwc+F3oQ7BNVZC/a0DUjhGqhIjT3I5W4J81TnQhz8o62+PjnTaxMts7DwAT 7XZxIJJvAdxa/ck43HHv4FdkqP7TjxwM3BLS3ZOzivUrfNOf5nq2//Qvmv1mTqXf6mma M5G8CZa/Qh8EsFcvyRMU8JiANzKsvojJoB7KD/5WoFhb8R2B2g3JVnMi6u/C0DSgOT4S WvYWOIYeobL+Sv3P4YDMVB5D8Cnu4bz8nRMPyCsiQoB4pm9XruCKoSkll0t9iWaAZOXG mxmVwUMUDDPSmvazKmcsBkdQcqmfqDZL2iwGOwSmQsEOBRezWREvs+dSvEU8R4q4lAPW 9MXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=xEu6cAM9pmTpfttF8e2oMkl90xLdoRvHCVPFFTjvbNo=; b=Fcg+qm6490JVMoRCA8DsSdRbci3rGTB0a74p8Yj9EMr/s4TBfL92wb1wWCNNB+M49/ hdXgXSyp+wzB4DVqT+1o7yq5iSC4CjPTFK+lBv4ljzqreFrcTi917qm+b5B3Rg2Zmdlm QQJtMOrzf/t24smJlPqLkiKnS2XTe6VeBOspqz49wo4dY/3hbHUyRoXQ5JZKJHmkpmu3 tpPid2fwbQ1Rfsf7HhBrOQ3bSZ2TrjlkYCHFlhIiMuZQq8zZamqjIdKNcGMtQPQfxuRk ATObtdpu1+4BD+B+YykB2r36JTkzn2S01GL6MvQRx3yFydvzIC2QF2Yh3srkYAYC3sBL OqzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kt41mzhh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si2545548otq.137.2019.12.05.23.58.28; Thu, 05 Dec 2019 23:58:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kt41mzhh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbfLFH5Z (ORCPT + 99 others); Fri, 6 Dec 2019 02:57:25 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40802 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725858AbfLFH5Z (ORCPT ); Fri, 6 Dec 2019 02:57:25 -0500 Received: by mail-lf1-f66.google.com with SMTP id y5so4545134lfy.7 for ; Thu, 05 Dec 2019 23:57:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xEu6cAM9pmTpfttF8e2oMkl90xLdoRvHCVPFFTjvbNo=; b=kt41mzhhzZcrOKXdVDG0ccgMoWbimeOhH2wggSrbIcSDNKHbn4jYw83Gvalvmc5JKX wgY+GKv1z8Y3ibrydIiYHEt/YWwmo17l9aslJWB4BMso65+PQH1CPFHWbAlb65oCLwXF LrrAPAPLo34QAbwT7QFPQx0RRKRfjH87www/57ahU2E+M9uJ8xT6f3awrJwRXpRLx63R s6ryERgUUIKQWsJk0zm/E46Zf69vLJU8RbfdEz36mvBtM2Hwzd2HVPThl7z3EwYNYZHB 8f8+1q1IGmuQZlwps6Z/TvjVKhcNQiDIlUHNVkLfu34mYgIuu/pmtFQnm7y1J+ELrL6L VyYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xEu6cAM9pmTpfttF8e2oMkl90xLdoRvHCVPFFTjvbNo=; b=Cy8Ox5uuLs6piDnw6UBuSD8pdkbH1YvT4e25Tvyq1YS6CqwdcAukt0pFuxTEvs2ruP pdueO8nVjjn3TpfIAwzPhBu0cnA86ezTRg/yOCBdSUYdVQhy77QOrZ4JCB3yleg4LL4w OLHy3ei7ccgVCM9a37DNlWUsRuZLZeTUM0UXxXmJh0H8/IcE7YEctRiw2fsb1YQSJEhv 9hj5uHfkgUbZkNqzr9AN4xrGUxH0fYWx/UnzqYPDhGB84nsOGpZdmppeRq7BBQwCqfPJ In/akcyNGNmi8ERzGJfcf/F8ViPkZt1tqsQ1p4dSxwSjPnC+5MN3JLBGOd52SDtWjoOa /FPg== X-Gm-Message-State: APjAAAWvplNBPSKUqWGX+286Zo9h0yrAcO07YYKJNGmwOjCZLA2M5ylH iR5nuSIfs4DhhPqn7X+xVwI4hOFiHwRdB9Rl5uLdWQ== X-Received: by 2002:ac2:43a7:: with SMTP id t7mr6729587lfl.125.1575619043523; Thu, 05 Dec 2019 23:57:23 -0800 (PST) MIME-Version: 1.0 References: <20191204200623.198897-1-joshdon@google.com> In-Reply-To: <20191204200623.198897-1-joshdon@google.com> From: Vincent Guittot Date: Fri, 6 Dec 2019 08:57:11 +0100 Message-ID: Subject: Re: [PATCH v2] sched/fair: Do not set skip buddy up the sched hierarchy To: Josh Don Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel , Paul Turner Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Josh, On Wed, 4 Dec 2019 at 21:06, Josh Don wrote: > > From: Venkatesh Pallipadi > > Setting skip buddy all the way up the hierarchy does not play well > with intra-cgroup yield. One typical usecase of yield is when a > thread in a cgroup wants to yield CPU to another thread within the > same cgroup. For such a case, setting the skip buddy all the way up > the hierarchy is counter-productive, as that results in CPU being > yielded to a task in some other cgroup. > > So, limit the skip effect only to the task requesting it. > > Signed-off-by: Josh Don There is a mismatch between the author Venkatesh Pallipadi and the signoff Josh Don If Venkatesh is the original author and you have then done some modifications, your both signed-off should be there Apart from that, the change makes sense to me > --- > v2: Only clear skip buddy on the current cfs_rq > > kernel/sched/fair.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 08a233e97a01..0b7a1958ad52 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -4051,13 +4051,10 @@ static void __clear_buddies_next(struct sched_entity *se) > > static void __clear_buddies_skip(struct sched_entity *se) > { > - for_each_sched_entity(se) { > - struct cfs_rq *cfs_rq = cfs_rq_of(se); > - if (cfs_rq->skip != se) > - break; > + struct cfs_rq *cfs_rq = cfs_rq_of(se); > > + if (cfs_rq->skip == se) > cfs_rq->skip = NULL; > - } > } > > static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) > @@ -6552,8 +6549,15 @@ static void set_next_buddy(struct sched_entity *se) > > static void set_skip_buddy(struct sched_entity *se) > { > - for_each_sched_entity(se) > - cfs_rq_of(se)->skip = se; > + /* > + * One typical usecase of yield is when a thread in a cgroup > + * wants to yield CPU to another thread within the same cgroup. > + * For such a case, setting the skip buddy all the way up the > + * hierarchy is counter-productive, as that results in CPU being > + * yielded to a task in some other cgroup. So, only set skip > + * for the task requesting it. > + */ > + cfs_rq_of(se)->skip = se; > } > > /* > -- > 2.24.0.393.g34dc348eaf-goog >