Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebc0f83

Browse files
Peter Zijlstra (Intel)Ingo Molnar
Peter Zijlstra (Intel)
authored and
Ingo Molnar
committed
timers/nohz: Update NOHZ load in remote tick
The way loadavg is tracked during nohz only pays attention to the loadupon entering nohz. This can be particularly noticeable if full nohz isentered while non-idle, and then the cpu goes idle and stays that way fora long time.Use the remote tick to ensure that full nohz cpus report their deltaswithin a reasonable time.[ swood: Added changelog and removed recheck of stopped tick. ]Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>Signed-off-by: Scott Wood <swood@redhat.com>Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>Signed-off-by: Ingo Molnar <mingo@kernel.org>Link:https://lkml.kernel.org/r/1578736419-14628-3-git-send-email-swood@redhat.com
1 parent488603b commitebc0f83

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

‎include/linux/sched/nohz.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ static inline void nohz_balance_enter_idle(int cpu) { }
1515

1616
#ifdefCONFIG_NO_HZ_COMMON
1717
voidcalc_load_nohz_start(void);
18+
voidcalc_load_nohz_remote(structrq*rq);
1819
voidcalc_load_nohz_stop(void);
1920
#else
2021
staticinlinevoidcalc_load_nohz_start(void) { }
22+
staticinlinevoidcalc_load_nohz_remote(structrq*rq) { }
2123
staticinlinevoidcalc_load_nohz_stop(void) { }
2224
#endif/* CONFIG_NO_HZ_COMMON */
2325

‎kernel/sched/core.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3677,6 +3677,7 @@ static void sched_tick_remote(struct work_struct *work)
36773677
if (cpu_is_offline(cpu))
36783678
gotoout_unlock;
36793679

3680+
curr=rq->curr;
36803681
update_rq_clock(rq);
36813682

36823683
if (!is_idle_task(curr)) {
@@ -3689,10 +3690,11 @@ static void sched_tick_remote(struct work_struct *work)
36893690
}
36903691
curr->sched_class->task_tick(rq,curr,0);
36913692

3693+
calc_load_nohz_remote(rq);
36923694
out_unlock:
36933695
rq_unlock_irq(rq,&rf);
3694-
36953696
out_requeue:
3697+
36963698
/*
36973699
* Run the remote tick once per second (1Hz). This arbitrary
36983700
* frequency is large enough to avoid overload but short enough

‎kernel/sched/loadavg.c‎

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,23 +231,36 @@ static inline int calc_load_read_idx(void)
231231
returncalc_load_idx&1;
232232
}
233233

234-
voidcalc_load_nohz_start(void)
234+
staticvoidcalc_load_nohz_fold(structrq*rq)
235235
{
236-
structrq*this_rq=this_rq();
237236
longdelta;
238237

239-
/*
240-
* We're going into NO_HZ mode, if there's any pending delta, fold it
241-
* into the pending NO_HZ delta.
242-
*/
243-
delta=calc_load_fold_active(this_rq,0);
238+
delta=calc_load_fold_active(rq,0);
244239
if (delta) {
245240
intidx=calc_load_write_idx();
246241

247242
atomic_long_add(delta,&calc_load_nohz[idx]);
248243
}
249244
}
250245

246+
voidcalc_load_nohz_start(void)
247+
{
248+
/*
249+
* We're going into NO_HZ mode, if there's any pending delta, fold it
250+
* into the pending NO_HZ delta.
251+
*/
252+
calc_load_nohz_fold(this_rq());
253+
}
254+
255+
/*
256+
* Keep track of the load for NOHZ_FULL, must be called between
257+
* calc_load_nohz_{start,stop}().
258+
*/
259+
voidcalc_load_nohz_remote(structrq*rq)
260+
{
261+
calc_load_nohz_fold(rq);
262+
}
263+
251264
voidcalc_load_nohz_stop(void)
252265
{
253266
structrq*this_rq=this_rq();
@@ -268,7 +281,7 @@ void calc_load_nohz_stop(void)
268281
this_rq->calc_load_update+=LOAD_FREQ;
269282
}
270283

271-
staticlongcalc_load_nohz_fold(void)
284+
staticlongcalc_load_nohz_read(void)
272285
{
273286
intidx=calc_load_read_idx();
274287
longdelta=0;
@@ -323,7 +336,7 @@ static void calc_global_nohz(void)
323336
}
324337
#else/* !CONFIG_NO_HZ_COMMON */
325338

326-
staticinlinelongcalc_load_nohz_fold(void) {return0; }
339+
staticinlinelongcalc_load_nohz_read(void) {return0; }
327340
staticinlinevoidcalc_global_nohz(void) { }
328341

329342
#endif/* CONFIG_NO_HZ_COMMON */
@@ -346,7 +359,7 @@ void calc_global_load(unsigned long ticks)
346359
/*
347360
* Fold the 'old' NO_HZ-delta to include all NO_HZ CPUs.
348361
*/
349-
delta=calc_load_nohz_fold();
362+
delta=calc_load_nohz_read();
350363
if (delta)
351364
atomic_long_add(delta,&calc_load_tasks);
352365

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp