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: Sort out 'blocked_load*' namespace noise

There's three layers of logic in the scheduler that
deal with 'has_blocked' (load) handling of the NOHZ code:

(1) nohz.has_blocked,
(2) rq->has_blocked_load, deal with NOHZ idle balancing,
(3) and cfs_rq_has_blocked(), which is part of the layer
that is passing the SMP load-balancing signal to the
NOHZ layers.

The 'has_blocked' and 'has_blocked_load' names are used
in a mixed fashion, sometimes within the same function.

Standardize on 'has_blocked_load' to make it all easy
to read and easy to grep.

No change in functionality.

Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Link: https://patch.msgid.link/aS6yvxyc3JfMxxQW@gmail.com

+20 -20
+20 -20
kernel/sched/fair.c
··· 7140 7140 static struct { 7141 7141 cpumask_var_t idle_cpus_mask; 7142 7142 atomic_t nr_cpus; 7143 - int has_blocked; /* Idle CPUS has blocked load */ 7143 + int has_blocked_load; /* Idle CPUS has blocked load */ 7144 7144 int needs_update; /* Newly idle CPUs need their next_balance collated */ 7145 7145 unsigned long next_balance; /* in jiffy units */ 7146 7146 unsigned long next_blocked; /* Next update of blocked load in jiffies */ ··· 9770 9770 } 9771 9771 9772 9772 #ifdef CONFIG_NO_HZ_COMMON 9773 - static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) 9773 + static inline bool cfs_rq_has_blocked_load(struct cfs_rq *cfs_rq) 9774 9774 { 9775 9775 if (cfs_rq->avg.load_avg) 9776 9776 return true; ··· 9803 9803 WRITE_ONCE(rq->last_blocked_load_update_tick, jiffies); 9804 9804 } 9805 9805 9806 - static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) 9806 + static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load) 9807 9807 { 9808 - if (!has_blocked) 9808 + if (!has_blocked_load) 9809 9809 rq->has_blocked_load = 0; 9810 9810 } 9811 9811 #else /* !CONFIG_NO_HZ_COMMON: */ 9812 - static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) { return false; } 9812 + static inline bool cfs_rq_has_blocked_load(struct cfs_rq *cfs_rq) { return false; } 9813 9813 static inline bool others_have_blocked(struct rq *rq) { return false; } 9814 9814 static inline void update_blocked_load_tick(struct rq *rq) {} 9815 - static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) {} 9815 + static inline void update_has_blocked_load_status(struct rq *rq, bool has_blocked_load) {} 9816 9816 #endif /* !CONFIG_NO_HZ_COMMON */ 9817 9817 9818 9818 static bool __update_blocked_others(struct rq *rq, bool *done) ··· 9869 9869 list_del_leaf_cfs_rq(cfs_rq); 9870 9870 9871 9871 /* Don't need periodic decay once load/util_avg are null */ 9872 - if (cfs_rq_has_blocked(cfs_rq)) 9872 + if (cfs_rq_has_blocked_load(cfs_rq)) 9873 9873 *done = false; 9874 9874 } 9875 9875 ··· 9929 9929 bool decayed; 9930 9930 9931 9931 decayed = update_cfs_rq_load_avg(cfs_rq_clock_pelt(cfs_rq), cfs_rq); 9932 - if (cfs_rq_has_blocked(cfs_rq)) 9932 + if (cfs_rq_has_blocked_load(cfs_rq)) 9933 9933 *done = false; 9934 9934 9935 9935 return decayed; ··· 9950 9950 decayed |= __update_blocked_others(rq, &done); 9951 9951 decayed |= __update_blocked_fair(rq, &done); 9952 9952 9953 - update_blocked_load_status(rq, !done); 9953 + update_has_blocked_load_status(rq, !done); 9954 9954 if (decayed) 9955 9955 cpufreq_update_util(rq, 0); 9956 9956 } ··· 12446 12446 if (likely(!atomic_read(&nohz.nr_cpus))) 12447 12447 return; 12448 12448 12449 - if (READ_ONCE(nohz.has_blocked) && 12449 + if (READ_ONCE(nohz.has_blocked_load) && 12450 12450 time_after(now, READ_ONCE(nohz.next_blocked))) 12451 12451 flags = NOHZ_STATS_KICK; 12452 12452 ··· 12607 12607 12608 12608 /* 12609 12609 * The tick is still stopped but load could have been added in the 12610 - * meantime. We set the nohz.has_blocked flag to trig a check of the 12610 + * meantime. We set the nohz.has_blocked_load flag to trig a check of the 12611 12611 * *_avg. The CPU is already part of nohz.idle_cpus_mask so the clear 12612 - * of nohz.has_blocked can only happen after checking the new load 12612 + * of nohz.has_blocked_load can only happen after checking the new load 12613 12613 */ 12614 12614 if (rq->nohz_tick_stopped) 12615 12615 goto out; ··· 12625 12625 12626 12626 /* 12627 12627 * Ensures that if nohz_idle_balance() fails to observe our 12628 - * @idle_cpus_mask store, it must observe the @has_blocked 12628 + * @idle_cpus_mask store, it must observe the @has_blocked_load 12629 12629 * and @needs_update stores. 12630 12630 */ 12631 12631 smp_mb__after_atomic(); ··· 12638 12638 * Each time a cpu enter idle, we assume that it has blocked load and 12639 12639 * enable the periodic update of the load of idle CPUs 12640 12640 */ 12641 - WRITE_ONCE(nohz.has_blocked, 1); 12641 + WRITE_ONCE(nohz.has_blocked_load, 1); 12642 12642 } 12643 12643 12644 12644 static bool update_nohz_stats(struct rq *rq) ··· 12679 12679 12680 12680 /* 12681 12681 * We assume there will be no idle load after this update and clear 12682 - * the has_blocked flag. If a cpu enters idle in the mean time, it will 12683 - * set the has_blocked flag and trigger another update of idle load. 12682 + * the has_blocked_load flag. If a cpu enters idle in the mean time, it will 12683 + * set the has_blocked_load flag and trigger another update of idle load. 12684 12684 * Because a cpu that becomes idle, is added to idle_cpus_mask before 12685 12685 * setting the flag, we are sure to not clear the state and not 12686 12686 * check the load of an idle cpu. ··· 12688 12688 * Same applies to idle_cpus_mask vs needs_update. 12689 12689 */ 12690 12690 if (flags & NOHZ_STATS_KICK) 12691 - WRITE_ONCE(nohz.has_blocked, 0); 12691 + WRITE_ONCE(nohz.has_blocked_load, 0); 12692 12692 if (flags & NOHZ_NEXT_KICK) 12693 12693 WRITE_ONCE(nohz.needs_update, 0); 12694 12694 12695 12695 /* 12696 - * Ensures that if we miss the CPU, we must see the has_blocked 12696 + * Ensures that if we miss the CPU, we must see the has_blocked_load 12697 12697 * store from nohz_balance_enter_idle(). 12698 12698 */ 12699 12699 smp_mb(); ··· 12760 12760 abort: 12761 12761 /* There is still blocked load, enable periodic update */ 12762 12762 if (has_blocked_load) 12763 - WRITE_ONCE(nohz.has_blocked, 1); 12763 + WRITE_ONCE(nohz.has_blocked_load, 1); 12764 12764 } 12765 12765 12766 12766 /* ··· 12822 12822 return; 12823 12823 12824 12824 /* Don't need to update blocked load of idle CPUs*/ 12825 - if (!READ_ONCE(nohz.has_blocked) || 12825 + if (!READ_ONCE(nohz.has_blocked_load) || 12826 12826 time_before(jiffies, READ_ONCE(nohz.next_blocked))) 12827 12827 return; 12828 12828