The patch titled Subject: mm: handle lru_add_drain_all for UP properly has been added to the -mm tree. Its filename is mm-handle-lru_add_drain_all-for-up-properly.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-handle-lru_add_drain_all-for-up-properly.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-handle-lru_add_drain_all-for-up-properly.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Michal Hocko <mhocko@xxxxxxxx> Subject: mm: handle lru_add_drain_all for UP properly Since for_each_cpu(cpu, mask) added by commit 2d3854a37e8b767a ("cpumask: introduce new API, without changing anything") did not evaluate the mask argument if NR_CPUS == 1 due to CONFIG_SMP=n, lru_add_drain_all() is hitting WARN_ON() at __flush_work() added by commit 4d43d395fed12463 ("workqueue: Try to catch flush_work() without INIT_WORK().") by unconditionally calling flush_work() [1]. Workaround this issue by using CONFIG_SMP=n specific lru_add_drain_all implementation. There is no real need to defer the implementation to the workqueue as the draining is going to happen on the local cpu. So alias lru_add_drain_all to lru_add_drain which does all the necessary work. [1] https://lkml.kernel.org/r/18a30387-6aa5-6123-e67c-57579ecc3f38@xxxxxxxxxxxx Link: http://lkml.kernel.org/r/20190213124334.GH4525@xxxxxxxxxxxxxx Signed-off-by: Michal Hocko <mhocko@xxxxxxxx> Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx> Debugged-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swap.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/mm/swap.c~mm-handle-lru_add_drain_all-for-up-properly +++ a/mm/swap.c @@ -660,6 +660,7 @@ static void lru_add_drain_per_cpu(struct static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work); +#ifdef CONFIG_SMP /* * Doesn't need any cpu hotplug locking because we do rely on per-cpu * kworkers being shut down before our page_alloc_cpu_dead callback is @@ -702,6 +703,12 @@ void lru_add_drain_all(void) mutex_unlock(&lock); } +#else +void lru_add_drain_all(void) +{ + lru_add_drain(); +} +#endif /** * release_pages - batched put_page() _ Patches currently in -mm which might be from mhocko@xxxxxxxx are proc-oom-do-not-report-alien-mms-when-setting-oom_score_adj.patch mm-handle-lru_add_drain_all-for-up-properly.patch