Skip to content

Commit 597b730

Browse files
Michal Hockotorvalds
Michal Hocko
authored andcommitted
mm: move mm_percpu_wq initialization earlier
Yang Li has reported that drain_all_pages triggers a WARN_ON which means that this function is called earlier than the mm_percpu_wq is initialized on arm64 with CMA configured: WARNING: CPU: 2 PID: 1 at mm/page_alloc.c:2423 drain_all_pages+0x244/0x25c Modules linked in: CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.11.0-rc1-next-20170310-00027-g64dfbc5 #127 Hardware name: Freescale Layerscape 2088A RDB Board (DT) task: ffffffc07c4a6d00 task.stack: ffffffc07c4a8000 PC is at drain_all_pages+0x244/0x25c LR is at start_isolate_page_range+0x14c/0x1f0 [...] drain_all_pages+0x244/0x25c start_isolate_page_range+0x14c/0x1f0 alloc_contig_range+0xec/0x354 cma_alloc+0x100/0x1fc dma_alloc_from_contiguous+0x3c/0x44 atomic_pool_init+0x7c/0x208 arm64_dma_init+0x44/0x4c do_one_initcall+0x38/0x128 kernel_init_freeable+0x1a0/0x240 kernel_init+0x10/0xfc ret_from_fork+0x10/0x20 Fix this by moving the whole setup_vmstat which is an initcall right now to init_mm_internals which will be called right after the WQ subsystem is initialized. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Michal Hocko <[email protected]> Reported-by: Yang Li <[email protected]> Tested-by: Yang Li <[email protected]> Tested-by: Xiaolong Ye <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Tetsuo Handa <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 4b0ece6 commit 597b730

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

include/linux/mm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct user_struct;
3232
struct writeback_control;
3333
struct bdi_writeback;
3434

35+
void init_mm_internals(void);
36+
3537
#ifndef CONFIG_NEED_MULTIPLE_NODES /* Don't use mapnrs, do it properly */
3638
extern unsigned long max_mapnr;
3739

init/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,8 @@ static noinline void __init kernel_init_freeable(void)
10221022

10231023
workqueue_init();
10241024

1025+
init_mm_internals();
1026+
10251027
do_pre_smp_initcalls();
10261028
lockup_detector_init();
10271029

mm/vmstat.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,7 +1764,7 @@ static int vmstat_cpu_dead(unsigned int cpu)
17641764

17651765
#endif
17661766

1767-
static int __init setup_vmstat(void)
1767+
void __init init_mm_internals(void)
17681768
{
17691769
#ifdef CONFIG_SMP
17701770
int ret;
@@ -1792,9 +1792,7 @@ static int __init setup_vmstat(void)
17921792
proc_create("vmstat", S_IRUGO, NULL, &proc_vmstat_file_operations);
17931793
proc_create("zoneinfo", S_IRUGO, NULL, &proc_zoneinfo_file_operations);
17941794
#endif
1795-
return 0;
17961795
}
1797-
module_init(setup_vmstat)
17981796

17991797
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
18001798

0 commit comments

Comments
 (0)