[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1512210656120.7119@east.gentwo.org>
Date: Mon, 21 Dec 2015 07:08:49 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Sasha Levin <sasha.levin@...cle.com>
cc: Michal Hocko <mhocko@...e.cz>, LKML <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: Re: mm, vmstat: kernel BUG at mm/vmstat.c:1408!
On Fri, 18 Dec 2015, Sasha Levin wrote:
> [ 531.164630] RIP vmstat_update (mm/vmstat.c:1408)
Hmmm.. Yes we need to fold the diffs first before disabling the timer
otherwise the shepherd task may intervene.
Does this patch fix it?
Subject: quiet_vmstat: Avoid race with shepherd by folding counters first
We need to fold the counters first otherwise the shepherd task may
remotely reactivate the vmstat worker.
This also avoids the strange loop. Nothing can really increase the
counters at that point since we are in the cpu idle loop. So
folding the counters once is enough. Cancelling work that does
not exist is fine too so just avoid the branches completely.
Signed-off-by: Christoph Lameter <cl@...ux.com>
Index: linux/mm/vmstat.c
===================================================================
--- linux.orig/mm/vmstat.c
+++ linux/mm/vmstat.c
@@ -1419,11 +1419,9 @@ void quiet_vmstat(void)
if (system_state != SYSTEM_RUNNING)
return;
- do {
- if (!cpumask_test_and_set_cpu(smp_processor_id(), cpu_stat_off))
- cancel_delayed_work(this_cpu_ptr(&vmstat_work));
-
- } while (refresh_cpu_vm_stats(false));
+ refresh_cpu_vm_stats(false);
+ cancel_delayed_work(this_cpu_ptr(&vmstat_work));
+ cpumask_set_cpu(smp_processor_id(), cpu_stat_off);
}
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists