[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191219001418.234372-1-joshdon@google.com>
Date: Wed, 18 Dec 2019 16:14:18 -0800
From: Josh Don <joshdon@...gle.com>
To: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
linux-kernel@...r.kernel.org, Paul Turner <pjt@...gle.com>,
Josh Don <joshdon@...gle.com>
Subject: [PATCH v3] sched/fair: Do not set skip buddy up the sched hierarchy
From: Venkatesh Pallipadi <venki@...gle.com>
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 <joshdon@...gle.com>
Signed-off-by: Josh Don <joshdon@...gle.com>
---
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
Powered by blists - more mailing lists