[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <160500731014.11244.11693121696022661111.tip-bot2@tip-bot2>
Date: Tue, 10 Nov 2020 11:21:50 -0000
From: "tip-bot2 for Peng Wang" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Peng Wang <rocking@...ux.alibaba.com>,
Ingo Molnar <mingo@...nel.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Phil Auld <pauld@...hat.com>, Ben Segall <bsegall@...gle.com>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched/fair: Reorder throttle_cfs_rq() path
The following commit has been merged into the sched/core branch of tip:
Commit-ID: b6d37a764a5b852db63101b3f2db0e699574b903
Gitweb: https://git.kernel.org/tip/b6d37a764a5b852db63101b3f2db0e699574b903
Author: Peng Wang <rocking@...ux.alibaba.com>
AuthorDate: Tue, 10 Nov 2020 10:11:59 +08:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Tue, 10 Nov 2020 12:20:12 +01:00
sched/fair: Reorder throttle_cfs_rq() path
As commit:
39f23ce07b93 ("sched/fair: Fix unthrottle_cfs_rq() for leaf_cfs_rq list")
does in unthrottle_cfs_rq(), throttle_cfs_rq() can also use the same
pattern as dequeue_task_fair().
No functional changes.
Signed-off-by: Peng Wang <rocking@...ux.alibaba.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Vincent Guittot <vincent.guittot@...aro.org>
Cc: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Phil Auld <pauld@...hat.com>
Cc: Ben Segall <bsegall@...gle.com>
Link: https://lore.kernel.org/r/f11dd2e3ab35cc538e2eb57bf0c99b6eaffce127.1604973978.git.rocking@linux.alibaba.com
---
kernel/sched/fair.c | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 52cacfc..2755a7e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4788,25 +4788,37 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)
struct cfs_rq *qcfs_rq = cfs_rq_of(se);
/* throttled entity or throttle-on-deactivate */
if (!se->on_rq)
- break;
+ goto done;
- if (dequeue) {
- dequeue_entity(qcfs_rq, se, DEQUEUE_SLEEP);
- } else {
- update_load_avg(qcfs_rq, se, 0);
- se_update_runnable(se);
- }
+ dequeue_entity(qcfs_rq, se, DEQUEUE_SLEEP);
qcfs_rq->h_nr_running -= task_delta;
qcfs_rq->idle_h_nr_running -= idle_task_delta;
- if (qcfs_rq->load.weight)
- dequeue = 0;
+ if (qcfs_rq->load.weight) {
+ /* Avoid re-evaluating load for this entity: */
+ se = parent_entity(se);
+ break;
+ }
}
- if (!se)
- sub_nr_running(rq, task_delta);
+ for_each_sched_entity(se) {
+ struct cfs_rq *qcfs_rq = cfs_rq_of(se);
+ /* throttled entity or throttle-on-deactivate */
+ if (!se->on_rq)
+ goto done;
+
+ update_load_avg(qcfs_rq, se, 0);
+ se_update_runnable(se);
+ qcfs_rq->h_nr_running -= task_delta;
+ qcfs_rq->idle_h_nr_running -= idle_task_delta;
+ }
+
+ /* At this point se is NULL and we are at root level*/
+ sub_nr_running(rq, task_delta);
+
+done:
/*
* Note: distribution will already see us throttled via the
* throttled-list. rq->lock protects completion.
Powered by blists - more mailing lists