Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3083910ybv; Mon, 24 Feb 2020 17:50:48 -0800 (PST) X-Google-Smtp-Source: APXvYqy1B1JHTsTyTgEBUNQmoFvgx0dHw0YMJl/YN5yv+1vXF/C29eEzWVfI4P8hqywVWpJ5KqQG X-Received: by 2002:aca:90f:: with SMTP id 15mr1636035oij.18.1582595448524; Mon, 24 Feb 2020 17:50:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582595448; cv=none; d=google.com; s=arc-20160816; b=jNeDfUyj0IRRjYcxkE1ZlDXsBRWSfRriMzT1O0PmfFV6i7NjEg/v1mtEcYEcRkOFQ9 sjGWjSr8SFm4QtICS4s457GfVeNi/9es4Jbyvxh/wGFk8UGlSAmiKTF72yu9ZIiPKru/ VI5MBDfueK05k3nfd52qGU4z6BOTiatQtPs3M8AGTY7r4X9C6iMT/nMSoL/B4wYUmPDK /3t/HH+J6eJT/qeN2YyhDe2jSzg8w/KrH4SdM5q0q4gcFjxy1WPsNJMlmz3m06KvmEM9 dIkZrd07C+tYQqrdnZRhW0KPNnPxnQJa/H/SobToe+i2rAshtEx6515JRW7QJbmjPuly t+uA== 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=658+MST6tRLPpeSgmfQnL9jvRO2fL056h095yosRw9k=; b=zuFXTVQWksGqaNVHDJVcZ0y9p3CJ0b4pqIfCNsD1H3EYHhMtvurGgKN4R3XKY2TvFs yW2tCHUA5D1lVjXeuGM5kKI8lmnThW4xb/aoXV//SN5CVjBMjxTSnmH0+W24qSabiUAh mJNWGwh/pFORQbCPgANn+5nujotznWZz8vSpM9t4+8i8QtWMbJY6andV0MHmKKaJW60H c9G6lgqKB05D+x4l58F31WtnAa9LSkRnYf974yLk7uEZgonhGSCLEcD3gDbV05h5wVzo J/5d+5gt1k1cUOnTkBxEKTQuhClvqT7Yl8AP8mlmPJ+IKjoMJroiWSv5b4jPCilUvXs7 7Aiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sHhKFEev; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si6023690oia.238.2020.02.24.17.50.36; Mon, 24 Feb 2020 17:50:48 -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=@google.com header.s=20161025 header.b=sHhKFEev; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728724AbgBYBuU (ORCPT + 99 others); Mon, 24 Feb 2020 20:50:20 -0500 Received: from mail-qv1-f66.google.com ([209.85.219.66]:37635 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgBYBuU (ORCPT ); Mon, 24 Feb 2020 20:50:20 -0500 Received: by mail-qv1-f66.google.com with SMTP id ci20so3703437qvb.4 for ; Mon, 24 Feb 2020 17:50:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=658+MST6tRLPpeSgmfQnL9jvRO2fL056h095yosRw9k=; b=sHhKFEevj+QRdk9OGUJHHHzCoP9/juukTB80Etwxnnci+MUyhhBdHYuwU8/0Nxh7tJ 16yONm0GtU6JkStXRdQLZi1aYoEkKZ5d3mdJd2LhL7yoOm4Plpi6KN7GEBXzQ0dv0PDc OS9Zq1GnczNJhHpcOPrjZ0ZD0n1JuX2IfzahhJUCPUnwFnKX1fuUH9+X0KqrNkkQE73D 7EGdo6JCQ7gSZ8n9iMH908JQMkKZAeRuwo8EwUSGXOKiYu7wFYObHtfijSMObyh3pSbY xiqPWUazXwH3GcuAiDtqt9YhLn1CbCKJ8vwTMloG7REI956s2VTFaXGpaTEm9bcQXCwd RToA== 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=658+MST6tRLPpeSgmfQnL9jvRO2fL056h095yosRw9k=; b=WNFerRzt/7ynx3pDXOBeRG/PhjoxSMFrzyFWcJlEEokiuUwFeqS8fgq6D7fzcLX8WV jbySYD2ynUQ2rZOVzd6rd3wpFr6fyKuTDVCP6Cjc4b9NO8jOZZqTpJOaABxwDnXReVcE 9QGkHg4DVU3Dr46SuoEBalioET9avD/s6UVpEM1Ho369gdedbQxZvdqNjdgLk1YkuSD9 18I/FLa9i/dsrZ73t6Ys5aJivVdyFs93g3MbnBCNP0RZroOG0FuIcgxMp7tM1kLz11pe kiRdE2AMktPD1e888ekP/5ig+mHwG6CmgOw3r1AvZbwPVSM3SBdVawcpmv3h37JvMcVT BDKQ== X-Gm-Message-State: APjAAAXXXZ/M4Hfh+7vKimYRD4o26PNfRnUlHpxY6mxD4SHQuxyd0g37 mQmjfBwfYhuzErPTXPC142b4CaFFt5KZbrhiQAxEPA== X-Received: by 2002:ad4:486f:: with SMTP id u15mr33166366qvy.235.1582595419053; Mon, 24 Feb 2020 17:50:19 -0800 (PST) MIME-Version: 1.0 References: <20191219001418.234372-1-joshdon@google.com> In-Reply-To: From: Josh Don Date: Mon, 24 Feb 2020 17:50:08 -0800 Message-ID: Subject: Re: [PATCH v3] sched/fair: Do not set skip buddy up the sched hierarchy To: Peter Zijlstra Cc: Vincent Guittot , Ingo Molnar , 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 Bumping in case this fell through the cracks of the patch queue On Thu, Dec 26, 2019 at 7:05 AM Vincent Guittot wrote: > > 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 > >