All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] sched/fair:Reduce unnecessary check preempt in the sched tick
@ 2021-04-13 13:18 qianjun.kernel
  2021-04-13 14:24 ` Peter Zijlstra
  2021-04-13 17:30   ` kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: qianjun.kernel @ 2021-04-13 13:18 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman
  Cc: linux-kernel, jun qian

From: jun qian <qianjun.kernel@gmail.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@gmail.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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-14  2:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 13:18 [PATCH 1/1] sched/fair:Reduce unnecessary check preempt in the sched tick qianjun.kernel
2021-04-13 14:24 ` Peter Zijlstra
2021-04-14  2:10   ` jun qian
2021-04-13 17:30 ` kernel test robot
2021-04-13 17:30   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.