Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9890285ybl; Thu, 26 Dec 2019 07:06:58 -0800 (PST) X-Google-Smtp-Source: APXvYqwO6kOWsYotvmW7E86cNzwHdf3d8qTWWfPrajpDYy7F0J66fc7ahDdsvSxPrwMX0p/vIKyv X-Received: by 2002:aca:c0c5:: with SMTP id q188mr2011265oif.169.1577372818039; Thu, 26 Dec 2019 07:06:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577372818; cv=none; d=google.com; s=arc-20160816; b=wK4d9/KvBGzEgTgTjjZ8GPFjLzftcMRfc/OA83JHfKzwuxfrhD4dnbnlva4lOnQ1GV w4hi8PRnZTTdcxBRMRkqUrRMktpOBD2BmI764qQ75vTbNWADuqTg2xi3tL16RYMp0Lva 756n2+gPrPC/fdEZBGQ3KkX5JwqyMmobOm5eUQ8bRzL4DPizPfhi0JIqDs0cvu5fyLwi Qgi5P5Y7Y5Wk+ceMP0Ul8vV6k5r0fxR4wLF+/iIK7PV3zC9JKJXK2yPCHkBj0WcDpxE3 okCZqkDrU+xeYcc2LvnulWMeBQ/YXRgfEnVPdJBoyYkVEsROOE47echo7w/QsciR1Xn/ /acQ== 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=1lXldyy2rUjU3vsUoz2r9OdaSkB56U7u5IkcDGjgTII=; b=CcYdUU4zKP3OqjPEi0wCh8JMhj9BLwLu3d0dBU+BqXar8zmDkPSUfPa6UHlFAv67WJ KOXcGw4KyceLAbxRV95l9adYBDLLitDYKurj8IMbuIgfD9GvnU81CC4Cl2R8e7/86Q9Y S13a7OFDolqKuxoAZvZ5/rUpEGCYQWaDX+iCtlZH8LKpmG7dQRXKQQ4VcjCGRv1MWF3g lquSyYP/PuxZMbybj1phtpin67y6ZJ3KmWIBnP1gMBbhPvBKEC0Y9fQmBnV1SnO65vN3 vp7nWvTe09QpsieamzKsY5ECfbZaih1rabO53EBiMk4JTA1G+jGy7Ve4UKLeVwzQdp0z iFkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dsXFwUWj; 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 e22si14514569oiy.124.2019.12.26.07.06.46; Thu, 26 Dec 2019 07:06:58 -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=dsXFwUWj; 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 S1726578AbfLZPF7 (ORCPT + 99 others); Thu, 26 Dec 2019 10:05:59 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:46510 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfLZPF7 (ORCPT ); Thu, 26 Dec 2019 10:05:59 -0500 Received: by mail-lf1-f66.google.com with SMTP id f15so18665116lfl.13 for ; Thu, 26 Dec 2019 07:05:58 -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=1lXldyy2rUjU3vsUoz2r9OdaSkB56U7u5IkcDGjgTII=; b=dsXFwUWj2zd+802wi1aSzCpV+f0+CNWG3n8KF710hGCXgXnuQzdIRllOjjfrq98ydU FIuEWvx0UCvqdPTywBHykRigcGPKwTdwx08JAELHGHF+62eVe/vrJzDt8B3NoI/9sa9K EszCslrtgVARJAconxW6W9+h3ucRfpwbgLb9sq4Uy4Nu+mpOVHbIcdEoaOzOgmYVeAeJ FKvN/aWdJkNN/orXe4rDae/OGLtgGYdpUNB79y+Rip2wmSguSUonHUb8nHvDd0DjOIrr Ujfu4NOHQaZmBTGNB+m88ZTxgk4fE6MKHsCGNYCgNWFgNl8uRX4Q+JWzdVp1CQ8bvHVi xXlg== 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=1lXldyy2rUjU3vsUoz2r9OdaSkB56U7u5IkcDGjgTII=; b=IPyIyKmrZDFtn2ra93zteEOz0lil4xE4R1GVFrDQ1HzBkaYdreHg5mT9kM/C4k1N+e Ghii3zHwEBQ8Qu0kRkLnPWHW54buzIXAWR9VPphbty/w2GxzepLO2+h8PkbrtM/NgkKV K3NojczyAZivSjSiIePVqHaoyvyoinFkYi1LFpatDnxnG8VNBp6HDrCOVoLJiNjDrJQp GQP3olXV8+khqxPJhgZIvWmKE5g0ANvTN1XbWEKpksHgOhoXOuJ4iQcWoBhmfK5jrBvZ SHNuKm/hNnF6PXRmlJZqQzxgWCPB6Sv4MN5Oykpe+Q6zBbeqltv9gZ7s7FtXhB6Q7Mw2 SyUA== X-Gm-Message-State: APjAAAWWDBj8ucmg8g64KMS1VPglI5E/mxDL01b6shHib7KVRd9fbt3L xc3lOZiKrB0qQeRszB0xvWzKoIZ1K8sFiPSv/saHUzXv X-Received: by 2002:ac2:44d9:: with SMTP id d25mr27409552lfm.15.1577372757749; Thu, 26 Dec 2019 07:05:57 -0800 (PST) MIME-Version: 1.0 References: <20191219001418.234372-1-joshdon@google.com> In-Reply-To: <20191219001418.234372-1-joshdon@google.com> From: Vincent Guittot Date: Thu, 26 Dec 2019 16:05:46 +0100 Message-ID: Subject: Re: [PATCH v3] 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 On Thu, 19 Dec 2019 at 01:14, Josh Don wrote: > > From: Venkatesh Pallipadi > > Setting the skip buddy up the hierarchy effectively means that a thread > calling yield will also end up skipping the other tasks in its hierarchy > as well. However, a yielding thread shouldn't end up causing this > behavior on behalf of its entire hierarchy. > > For typical uses of yield, setting the skip buddy 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. > > Co-developed-by: Josh Don > Signed-off-by: Josh Don Reviewed-by: Vincent Guittot > --- > v2: Only clear skip buddy on the current cfs_rq > > v3: Modify comment describing the justification for this change. > > kernel/sched/fair.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 08a233e97a01..0056b57d52cb 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,12 @@ 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; > + /* > + * Only set the skip buddy for the task requesting it. Setting the skip > + * buddy up the hierarchy would result in skipping all other tasks in > + * the hierarchy as well. > + */ > + cfs_rq_of(se)->skip = se; > } > > /* > -- > 2.24.1.735.g03f4e72817-goog >