mm/mm_init.c: introduce reset_memoryless_node_totalpages()
authorHaifeng Xu <haifeng.xu@shopee.com>
Fri, 26 May 2023 08:52:50 +0000 (08:52 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 9 Jun 2023 23:25:48 +0000 (16:25 -0700)
commitba1b67c79cb3c5f5d11cb475bb7045929b235538
tree602444784b379d874641955e3d5fe48280907535
parentda9698105c7a84f601e81ea1f5f39ba53f6b9d7c
mm/mm_init.c: introduce reset_memoryless_node_totalpages()

Currently, no matter whether a node actually has memory or not,
calculate_node_totalpages() is used to account number of pages in
zone/node.  However, for node without memory, these unnecessary
calculations can be skipped.  All the zone/node page counts can be set to
0 directly.  So introduce reset_memoryless_node_totalpages() to perform
this action.

Furthermore, calculate_node_totalpages() only gets called for the node
with memory.

Link: https://lkml.kernel.org/r/20230526085251.1977-1-haifeng.xu@shopee.com
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Suggested-by: Mike Rapoport <rppt@kernel.org>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mm_init.c