mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel/sched/fair: Fix to not require calculation for the weight nice0
@ 2026-05-29  2:34 Li kunyu
  2026-05-29  7:37 ` Hongyan Xia
  0 siblings, 1 reply; 4+ messages in thread
From: Li kunyu @ 2026-05-29  2:34 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak
  Cc: linux-kernel, Li kunyu

Typically, the default priority for client tasks is nice0, and reducing
the conversion of virtual runtime to real time for nice0 tasks can
significantly reduce unnecessary computations.

Signed-off-by: Li kunyu <likunyu10@163.com>
---
 kernel/sched/fair.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 69361c63353a..74d1c77a8bcf 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7033,7 +7033,10 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
 			resched_curr(rq);
 		return;
 	}
-	delta = (se->load.weight * vdelta) / NICE_0_LOAD;
+	if (unlikely(se->load.weight != NICE_0_LOAD))
+		delta = (se->load.weight * vdelta) / NICE_0_LOAD;
+	else
+		delta = vdelta;
 
 	/*
 	 * Correct for instantaneous load of other classes.
-- 
2.47.3


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

end of thread, other threads:[~2026-05-29 12:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-29  2:34 [PATCH] kernel/sched/fair: Fix to not require calculation for the weight nice0 Li kunyu
2026-05-29  7:37 ` Hongyan Xia
2026-05-29  8:13   ` Li kunyu
2026-05-29 12:01   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®