Skip to content

Commit 902d67a

Browse files
committed
sched: Move update_other_load_avgs() to kernel/sched/pelt.c
96fd6c6 ("sched: Factor out update_other_load_avgs() from __update_blocked_others()") added update_other_load_avgs() in kernel/sched/syscalls.c right above effective_cpu_util(). This location didn't fit that well in the first place, and with 5d871a6 ("sched/fair: Move effective_cpu_util() and effective_cpu_util() in fair.c") moving effective_cpu_util() to kernel/sched/fair.c, it looks even more out of place. Relocate the function to kernel/sched/pelt.c where all its callees are. No functional changes. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@redhat.com>
1 parent 0b1777f commit 902d67a

File tree

4 files changed

+21
-24
lines changed

4 files changed

+21
-24
lines changed

kernel/sched/pelt.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,23 @@ int update_irq_load_avg(struct rq *rq, u64 running)
467467
return ret;
468468
}
469469
#endif
470+
471+
/*
472+
* Load avg and utiliztion metrics need to be updated periodically and before
473+
* consumption. This function updates the metrics for all subsystems except for
474+
* the fair class. @rq must be locked and have its clock updated.
475+
*/
476+
bool update_other_load_avgs(struct rq *rq)
477+
{
478+
u64 now = rq_clock_pelt(rq);
479+
const struct sched_class *curr_class = rq->curr->sched_class;
480+
unsigned long hw_pressure = arch_scale_hw_pressure(cpu_of(rq));
481+
482+
lockdep_assert_rq_held(rq);
483+
484+
/* hw_pressure doesn't care about invariance */
485+
return update_rt_rq_load_avg(now, rq, curr_class == &rt_sched_class) |
486+
update_dl_rq_load_avg(now, rq, curr_class == &dl_sched_class) |
487+
update_hw_load_avg(rq_clock_task(rq), rq, hw_pressure) |
488+
update_irq_load_avg(rq, 0);
489+
}

kernel/sched/pelt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ int __update_load_avg_se(u64 now, struct cfs_rq *cfs_rq, struct sched_entity *se
66
int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cfs_rq);
77
int update_rt_rq_load_avg(u64 now, struct rq *rq, int running);
88
int update_dl_rq_load_avg(u64 now, struct rq *rq, int running);
9+
bool update_other_load_avgs(struct rq *rq);
910

1011
#ifdef CONFIG_SCHED_HW_PRESSURE
1112
int update_hw_load_avg(u64 now, struct rq *rq, u64 capacity);

kernel/sched/sched.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,8 +3245,6 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) { }
32453245

32463246
#ifdef CONFIG_SMP
32473247

3248-
bool update_other_load_avgs(struct rq *rq);
3249-
32503248
unsigned long effective_cpu_util(int cpu, unsigned long util_cfs,
32513249
unsigned long *min,
32523250
unsigned long *max);

kernel/sched/syscalls.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -258,28 +258,6 @@ int sched_core_idle_cpu(int cpu)
258258

259259
#endif
260260

261-
#ifdef CONFIG_SMP
262-
/*
263-
* Load avg and utiliztion metrics need to be updated periodically and before
264-
* consumption. This function updates the metrics for all subsystems except for
265-
* the fair class. @rq must be locked and have its clock updated.
266-
*/
267-
bool update_other_load_avgs(struct rq *rq)
268-
{
269-
u64 now = rq_clock_pelt(rq);
270-
const struct sched_class *curr_class = rq->curr->sched_class;
271-
unsigned long hw_pressure = arch_scale_hw_pressure(cpu_of(rq));
272-
273-
lockdep_assert_rq_held(rq);
274-
275-
/* hw_pressure doesn't care about invariance */
276-
return update_rt_rq_load_avg(now, rq, curr_class == &rt_sched_class) |
277-
update_dl_rq_load_avg(now, rq, curr_class == &dl_sched_class) |
278-
update_hw_load_avg(rq_clock_task(rq), rq, hw_pressure) |
279-
update_irq_load_avg(rq, 0);
280-
}
281-
#endif /* CONFIG_SMP */
282-
283261
/**
284262
* find_process_by_pid - find a process with a matching PID value.
285263
* @pid: the pid in question.

0 commit comments

Comments
 (0)