Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1442132
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [patch 10/15] sched/migration: Move calc_load_migrate() into CPU_DYING |
| Date | 2016-07-13 10:00 +0200 |
| Message-ID | <rUnfj-8tL-5@gated-at.bofh.it> (permalink) |
| References | <rb7zI-6OQ-3@gated-at.bofh.it> <rb7zI-6OQ-13@gated-at.bofh.it> <rTY7f-ra-1@gated-at.bofh.it> <rU8T0-7sL-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Jul 12, 2016 at 06:33:56PM +0200, Thomas Gleixner wrote:
> Subject: sched/migration: Correct off by one in load migration
> From: Thomas Gleixner <tglx@linutronix.de>
>
> The move of calc_load_migrate() from CPU_DEAD to CPU_DYING did not take into
> account that the function is now called from a thread running on the outgoing
> CPU. As a result a cpu unplug leakes a load of 1 into the global load
> accounting mechanism.
>
> Fix it by adjusting for the currently running thread which calls
> calc_load_migrate().
>
> Fixes: e9cd8fa4fcfd: "sched/migration: Move calc_load_migrate() into CPU_DYING"
> Reported-by: Anton Blanchard <anton@samba.org>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> +++ b/kernel/sched/loadavg.c
> @@ -78,11 +78,11 @@ void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
> loads[2] = (avenrun[2] + offset) << shift;
> }
>
> -long calc_load_fold_active(struct rq *this_rq)
> +long calc_load_fold_active(struct rq *this_rq, long adjust)
> {
> long nr_active, delta = 0;
>
> - nr_active = this_rq->nr_running;
> + nr_active = this_rq->nr_running - adjust;
> nr_active += (long)this_rq->nr_uninterruptible;
>
> if (nr_active != this_rq->calc_load_active) {
Yeah, I think this is the only sensible approach.
How do you want to route this?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [patch 10/15] sched/migration: Move calc_load_migrate() into CPU_DYING Anton Blanchard <anton@samba.org> - 2016-07-12 07:10 +0200
Re: [patch 10/15] sched/migration: Move calc_load_migrate() into CPU_DYING Thomas Gleixner <tglx@linutronix.de> - 2016-07-12 18:40 +0200
Re: [patch 10/15] sched/migration: Move calc_load_migrate() into CPU_DYING Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> - 2016-07-12 21:00 +0200
Re: [patch 10/15] sched/migration: Move calc_load_migrate() into CPU_DYING Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2016-07-12 22:10 +0200
Re: [patch 10/15] sched/migration: Move calc_load_migrate() into CPU_DYING Peter Zijlstra <peterz@infradead.org> - 2016-07-13 10:00 +0200
[tip:sched/urgent] sched/core: Correct off by one bug in load migration calculation tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-13 15:50 +0200
csiph-web