Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/fair: Introduce is_rd_overutilized() helper function to access root_domain::overutilized

The root_domain::overutilized field is READ_ONCE() accessed in
multiple places, which could be simplified with a helper function.

This might also make it more apparent that it needs to be used
only in case of EAS.

No change in functionality intended.

Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Qais Yousef <qyousef@layalina.io>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/20240307085725.444486-3-sshegde@linux.ibm.com

authored by

Shrikanth Hegde and committed by
Ingo Molnar
d0f5d3ce be3a51e6

+12 -3
+12 -3
kernel/sched/fair.c
··· 6685 6685 return !util_fits_cpu(cpu_util_cfs(cpu), rq_util_min, rq_util_max, cpu); 6686 6686 } 6687 6687 6688 + /* 6689 + * Ensure that caller can do EAS. overutilized value 6690 + * make sense only if EAS is enabled 6691 + */ 6692 + static inline int is_rd_overutilized(struct root_domain *rd) 6693 + { 6694 + return READ_ONCE(rd->overutilized); 6695 + } 6696 + 6688 6697 static inline void set_rd_overutilized_status(struct root_domain *rd, 6689 6698 unsigned int status) 6690 6699 { ··· 6713 6704 if (!sched_energy_enabled()) 6714 6705 return; 6715 6706 6716 - if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) 6707 + if (!is_rd_overutilized(rq->rd) && cpu_overutilized(rq->cpu)) 6717 6708 set_rd_overutilized_status(rq->rd, SG_OVERUTILIZED); 6718 6709 } 6719 6710 #else ··· 7999 7990 8000 7991 rcu_read_lock(); 8001 7992 pd = rcu_dereference(rd->pd); 8002 - if (!pd || READ_ONCE(rd->overutilized)) 7993 + if (!pd || is_rd_overutilized(rd)) 8003 7994 goto unlock; 8004 7995 8005 7996 /* ··· 10906 10897 if (sched_energy_enabled()) { 10907 10898 struct root_domain *rd = env->dst_rq->rd; 10908 10899 10909 - if (rcu_dereference(rd->pd) && !READ_ONCE(rd->overutilized)) 10900 + if (rcu_dereference(rd->pd) && !is_rd_overutilized(rd)) 10910 10901 goto out_balanced; 10911 10902 } 10912 10903