LKML Archive on
help / color / mirror / Atom feed
* [PATCH REPOST] Revert mm/vmstat.c: fix vmstat_update() preemption BUG
@ 2018-05-04 10:44 Sebastian Andrzej Siewior
  2018-05-07  7:31 ` Vlastimil Babka
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-05-04 10:44 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: tglx, Vlastimil Babka, Sebastian Andrzej Siewior,
	Steven J . Hill, Tejun Heo, Andrew Morton

This patch reverts commit c7f26ccfb2c3 ("mm/vmstat.c: fix
vmstat_update() preemption BUG").
Steven saw a "using smp_processor_id() in preemptible" message and
added a preempt_disable() section around it to keep it quiet. This is
not the right thing to do it does not fix the real problem.

vmstat_update() is invoked by a kworker on a specific CPU. This worker
it bound to this CPU. The name of the worker was "kworker/1:1" so it
should have been a worker which was bound to CPU1. A worker which can
run on any CPU would have a `u' before the first digit.

smp_processor_id() can be used in a preempt-enabled region as long as
the task is bound to a single CPU which is the case here. If it could
run on an arbitrary CPU then this is the problem we have an should seek
to resolve.
Not only this smp_processor_id() must not be migrated to another CPU but
also refresh_cpu_vm_stats() which might access wrong per-CPU variables.
Not to mention that other code relies on the fact that such a worker
runs on one specific CPU only.

Therefore I revert that commit and we should look instead what broke the
affinity mask of the kworker.

Cc: Steven J. Hill <>
Cc: Tejun Heo <>
Cc: Andrew Morton <>
Signed-off-by: Sebastian Andrzej Siewior <>
 mm/vmstat.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 33581be705f0..40b2db6db6b1 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1839,11 +1839,9 @@ static void vmstat_update(struct work_struct *w)
 		 * to occur in the future. Keep on running the
 		 * update worker thread.
-		preempt_disable();
 		queue_delayed_work_on(smp_processor_id(), mm_percpu_wq,
-		preempt_enable();

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-27 19:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 10:44 [PATCH REPOST] Revert mm/vmstat.c: fix vmstat_update() preemption BUG Sebastian Andrzej Siewior
2018-05-07  7:31 ` Vlastimil Babka
2018-05-08 23:02   ` Andrew Morton
2018-05-09 22:35     ` Sebastian Andrzej Siewior
2018-05-10  6:32       ` Vlastimil Babka
2018-06-13 21:46         ` Thomas Gleixner
2018-06-14 21:27           ` Andrew Morton
2018-06-27 19:40             ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).