Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1350ybx; Thu, 31 Oct 2019 14:53:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDqltH6nmka/jAM4nBFqM6haWWU7aPe7mPUTx9r6AFhAraAOZXIDkANTeA/CpvubfrqiDX X-Received: by 2002:a05:6402:713:: with SMTP id w19mr9078470edx.239.1572558796502; Thu, 31 Oct 2019 14:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572558796; cv=none; d=google.com; s=arc-20160816; b=VYW9szLLVV7uPcQFoR1+JRmF0NceTlf6ULMki+SLHhMjXiVe/LixoGYLuDLWlPAI2D b011OWIimsWVtGcpy6mANxxLxgewcInPD7c8emVpgGlahD0bYaoR3V/K3MjGoresEXr2 3g8do6526SGJB4AUOW+xgg25FIHn+8PiGK81GF2Q67fjD5Lv6+FQjFmJQkbfd27J2/Rf SYp/umf9m5F3jHdiWXrkqAVsjjEMfO4w2NsEBvjZzKs0vd6gySwz3JKVlTS8hTpPVnmY ImhcTBANx4cRYG9Tk3LbSiNIstov93b6p90md7snlhVLOq7T3WS8qY6Ep6eOGhbHYohw BKhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=8ALf84QyJ21Yy83EcsBZYx0R5ySmANW7J5oD5E9Gtsc=; b=w3bm3KaBcvNdGioYlWEgYZu8hABL+xea0di/LizEY0ung1wi150cU3tAEtogsoiTo+ +hq+mc7fcuLYY211tclQJVjmfsxMZZ5e4V9OYIc8ad2LqDlcwrexaSiSQljeU562n+4Q REOp7jHxcbE3NbLOUHEXzqakjdtnW5P3sfdP7p/MwIcvJFgOQ1SLXD/yLS8HxAjNrmN1 /ejo65KAk38GToRAoc39ZnIuSXJVWW6B97lOVl8bYevTqdg8GqWfkHji4YOX+44CzXb9 gZdYC14yJn59RaEkzKDj4ZGCdu0nJ9P5NLX5+U3+2q56WHfgZPa1Tqrk9k6KoRTgSW7N aHDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WUSQhNBA; 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 t3si4338020ejr.121.2019.10.31.14.52.43; Thu, 31 Oct 2019 14:53:16 -0700 (PDT) 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=WUSQhNBA; 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 S1729334AbfJaSpk (ORCPT + 99 others); Thu, 31 Oct 2019 14:45:40 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:33142 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729313AbfJaSpk (ORCPT ); Thu, 31 Oct 2019 14:45:40 -0400 Received: by mail-qt1-f201.google.com with SMTP id k53so7290408qtk.0 for ; Thu, 31 Oct 2019 11:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=8ALf84QyJ21Yy83EcsBZYx0R5ySmANW7J5oD5E9Gtsc=; b=WUSQhNBAOxFkVi7Km6IbhgY+FLELPn8N20pipsZpHhKH3RIy/SdgG+EC4r8hz6fznI ONaTeM7G+L6JDvf1deTj/CWq/4QnIhe06e4mRHS0LJBKW6lnhRj1U5zKz3skyHMfQAL4 uCiHZQNIq31Oqil/PmGKreOtZD8dJ3Kl+FTCWChnThvafmwBdxQft7VGFUXTzNsc1YUm yCtbC9D652rQpFqNbUUvXQRM3WVxgYNtD/cMH9VxH+oahlNo4QM4tlFDkrBt+kBZ6aJG 0Wg9w6eYhkaryFrrwuwP3QezYuQXYrcGh/RqeBKBQoznD8OvZz5ByenyMAYvDajZ1yW2 8eVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=8ALf84QyJ21Yy83EcsBZYx0R5ySmANW7J5oD5E9Gtsc=; b=t06D7L3knSkPohtir/XgChK+rbnB0YbtgnHAs5CIr7IGNU5hzyiQcqZ/ytbRfQ+rOm eAripJ48aR7OTKBPTZG+S9IP1t2B+fB9GLrN9Fctotuz+bMtzUdtmj+TqZBJc0dqWZEv uDhhVyR/X1/PM826ry2EDe8hsUZt4/4vSkdmxz9tyb23u4LDsNLST8bRS6NGU95ycbHE tRWC5qTf41HzoJ/E/9ZDGUO19gfDYbIned1yBf07EAQ9D8Wv6yQyaEQxOycecUWvpNwX M83PbQ9IuWIjLMiL/zlqdPvg3TRZvSPrP1+Hf9fAwvIXBuGGKhX4fsFhYEeM2uNYDlyn YSaw== X-Gm-Message-State: APjAAAUP4vmD9TuxwoCBuTg2prjpM7YsNPf2+HoUtZnEiHJmQ/lo6qaL 7lbeb3Rh5BvUv5DN1PYyV8ceVJVEXZ14 X-Received: by 2002:ad4:5345:: with SMTP id v5mr6154067qvs.217.1572547538807; Thu, 31 Oct 2019 11:45:38 -0700 (PDT) Date: Thu, 31 Oct 2019 11:45:33 -0700 Message-Id: <20191031184533.67118-1-joshdon@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog Subject: [PATCH] sched/fair: Do not set skip buddy up the sched hierarchy From: Josh Don To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot Cc: Dietmar Eggemann , Steven Rostedt , Ben Segall , Paul Turner , Mel Gorman , linux-kernel@vger.kernel.org, Venkatesh Pallipadi , Josh Don 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 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 --- kernel/sched/fair.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 682a754ea3e1..52ab06585d7f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6647,8 +6647,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.23.0.700.g56cf767bdb-goog