summary refs log tree commit diff
path: root/arch/x86/mm/init_64.c
diff options
context:
space:
mode:
authorWei Yang <richard.weiyang@gmail.com>2018-12-28 00:36:18 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-28 12:11:49 -0800
commit23b68cfaae0ea40a9509fad37b756a6916dec54e (patch)
tree164b7b8e89281a52b32b81d90332c24b85d95c78 /arch/x86/mm/init_64.c
parent9a1ea439b16b92002e0a6fceebc5d1794906e297 (diff)
downloadlinux-23b68cfaae0ea40a9509fad37b756a6916dec54e.tar.gz
mm: check nr_initialised with PAGES_PER_SECTION directly in defer_init()
When DEFERRED_STRUCT_PAGE_INIT is configured, only the first section of
each node's highest zone is initialized before defer stage.

static_init_pgcnt is used to store the number of pages like this:

    pgdat->static_init_pgcnt = min_t(unsigned long, PAGES_PER_SECTION,
                                              pgdat->node_spanned_pages);

because we don't want to overflow zone's range.

But this is not necessary, since defer_init() is called like this:

  memmap_init_zone()
    for pfn in [start_pfn, end_pfn)
      defer_init(pfn, end_pfn)

In case (pgdat->node_spanned_pages < PAGES_PER_SECTION), the loop would
stop before calling defer_init().

BTW, comparing PAGES_PER_SECTION with node_spanned_pages is not correct,
since nr_initialised is zone based instead of node based.  Even
node_spanned_pages is bigger than PAGES_PER_SECTION, its highest zone
would have pages less than PAGES_PER_SECTION.

Link: http://lkml.kernel.org/r/20181122094807.6985-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/mm/init_64.c')
0 files changed, 0 insertions, 0 deletions