mirror of
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9.git
synced 2026-09-09 00:08:12 +08:00
sched/fair: Small cleanup to update_newidle_cost()
JIRA: https://issues.redhat.com/browse/RHEL-147187 commit 08d473dd8718e4a4d698b1113a14a40ad64a909b Author: Peter Zijlstra <peterz@infradead.org> Date: Fri Nov 7 17:01:27 2025 +0100 sched/fair: Small cleanup to update_newidle_cost() Simplify code by adding a few variables. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Tested-by: Chris Mason <clm@meta.com> Link: https://patch.msgid.link/20251107161739.655208666@infradead.org (cherry picked from commit 08d473dd8718e4a4d698b1113a14a40ad64a909b) Assisted-by: Patchpal Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
This commit is contained in:
+7
-4
@@ -11686,22 +11686,25 @@ void update_max_interval(void)
|
||||
|
||||
static inline bool update_newidle_cost(struct sched_domain *sd, u64 cost)
|
||||
{
|
||||
unsigned long next_decay = sd->last_decay_max_lb_cost + HZ;
|
||||
unsigned long now = jiffies;
|
||||
|
||||
if (cost > sd->max_newidle_lb_cost) {
|
||||
/*
|
||||
* Track max cost of a domain to make sure to not delay the
|
||||
* next wakeup on the CPU.
|
||||
*/
|
||||
sd->max_newidle_lb_cost = cost;
|
||||
sd->last_decay_max_lb_cost = jiffies;
|
||||
} else if (time_after(jiffies, sd->last_decay_max_lb_cost + HZ)) {
|
||||
sd->last_decay_max_lb_cost = now;
|
||||
|
||||
} else if (time_after(now, next_decay)) {
|
||||
/*
|
||||
* Decay the newidle max times by ~1% per second to ensure that
|
||||
* it is not outdated and the current max cost is actually
|
||||
* shorter.
|
||||
*/
|
||||
sd->max_newidle_lb_cost = (sd->max_newidle_lb_cost * 253) / 256;
|
||||
sd->last_decay_max_lb_cost = jiffies;
|
||||
|
||||
sd->last_decay_max_lb_cost = now;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user