• Michal Hocko's avatar
    mm: move mm_percpu_wq initialization earlier · 597b7305
    Michal Hocko authored
    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/20170315164021.28532-1-mhocko@kernel.orgSigned-off-by: default avatarMichal Hocko <mhocko@suse.com>
    Reported-by: default avatarYang Li <pku.leo@gmail.com>
    Tested-by: default avatarYang Li <pku.leo@gmail.com>
    Tested-by: default avatarXiaolong Ye <xiaolong.ye@intel.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    597b7305
mm.h 79.1 KB