[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210413131842.44430-1-qianjun.kernel@gmail.com>
Date: Tue, 13 Apr 2021 21:18:42 +0800
From: qianjun.kernel@...il.com
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de
Cc: linux-kernel@...r.kernel.org, jun qian <qianjun.kernel@...il.com>
Subject: [PATCH 1/1] sched/fair:Reduce unnecessary check preempt in the sched tick
From: jun qian <qianjun.kernel@...il.com>
If it has been determined that the current cpu need resched in the
early stage of for_each_sched_entity, then there is no need to check
preempt in the subsequent se->parent entity_tick.
Signed-off-by: jun qian <qianjun.kernel@...il.com>
---
kernel/sched/fair.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1a68a0536add..c0d135100d54 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4352,8 +4352,13 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
{
unsigned long ideal_runtime, delta_exec;
struct sched_entity *se;
+ struct rq *rq = rq_of(cfs_rq);
s64 delta;
+ /* If the TIF_NEED_RESCHED has been set, it is no need to check again */
+ if (test_tsk_need_resched(rq->curr))
+ return;
+
ideal_runtime = sched_slice(cfs_rq, curr);
delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime;
if (delta_exec > ideal_runtime) {
--
2.18.2
Powered by blists - more mailing lists