Re: [PATCH] vmstat: allocate vmstat_wq before it is used

From: Tetsuo Handa
Date: Sat Jan 09 2016 - 01:54:46 EST


Linus Torvalds wrote:
> On Fri, Jan 8, 2016 at 4:13 PM, Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Was there confirmation this fixed the issue? Just verifying..

I confirmed that

----------
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 4ebc17d..0486d3d 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -27,6 +27,7 @@
#include <linux/mm_inline.h>
#include <linux/page_ext.h>
#include <linux/page_owner.h>
+#include <linux/delay.h>

#include "internal.h"

@@ -1550,6 +1551,7 @@ static int __init setup_vmstat(void)

start_shepherd_timer();
cpu_notifier_register_done();
+ ssleep(3);
vmstat_wq = alloc_workqueue("vmstat", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
#endif
#ifdef CONFIG_PROC_FS
----------

always reproduces this bug and

----------
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 4ebc17d..358c1b7 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -27,6 +27,7 @@
#include <linux/mm_inline.h>
#include <linux/page_ext.h>
#include <linux/page_owner.h>
+#include <linux/delay.h>

#include "internal.h"

@@ -1483,6 +1484,8 @@ static void __init start_shepherd_timer(void)
BUG();
cpumask_copy(cpu_stat_off, cpu_online_mask);

+ ssleep(3);
+ vmstat_wq = alloc_workqueue("vmstat", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
schedule_delayed_work(&shepherd,
round_jiffies_relative(sysctl_stat_interval));
}
@@ -1550,7 +1553,6 @@ static int __init setup_vmstat(void)

start_shepherd_timer();
cpu_notifier_register_done();
- vmstat_wq = alloc_workqueue("vmstat", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
#endif
#ifdef CONFIG_PROC_FS
proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
----------

never reproduces this bug. Thus, I think it is OK to sneak it into 4.4.

>
> Oh, and Tetsuo claims that it needs a cc stable regardless, because
> the commit that caused this to appear was marked for stable and
> already got backported. Yes?
>
> Linus
>

Yes, please.