diff options
author | Yajun Deng <yajun.deng@linux.dev> | 2023-06-19 04:34:06 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-06-24 01:59:27 +0200 |
commit | 61167ad5fecdeaa037f3df1ba354dddd5f66a1ed (patch) | |
tree | b0e08754150ba76f267e9181f2a6173f2d99776c /mm/swapfile.c | |
parent | mm/gup: do not return 0 from pin_user_pages_fast() for bad args (diff) | |
download | linux-61167ad5fecdeaa037f3df1ba354dddd5f66a1ed.tar.xz linux-61167ad5fecdeaa037f3df1ba354dddd5f66a1ed.zip |
mm: pass nid to reserve_bootmem_region()
early_pfn_to_nid() is called frequently in init_reserved_page(), it
returns the node id of the PFN. These PFN are probably from the same
memory region, they have the same node id. It's not necessary to call
early_pfn_to_nid() for each PFN.
Pass nid to reserve_bootmem_region() and drop the call to
early_pfn_to_nid() in init_reserved_page(). Also, set nid on all reserved
pages before doing this, as some reserved memory regions may not be set
nid.
The most beneficial function is memmap_init_reserved_pages() if
CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled.
The following data was tested on an x86 machine with 190GB of RAM.
before:
memmap_init_reserved_pages() 67ms
after:
memmap_init_reserved_pages() 20ms
Link: https://lkml.kernel.org/r/20230619023406.424298-1-yajun.deng@linux.dev
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/swapfile.c')
0 files changed, 0 insertions, 0 deletions