mm/mm_init.c: simplify logic of deferred_[init|free]_pages
authorWei Yang <richard.weiyang@gmail.com>
Wed, 12 Jun 2024 02:04:21 +0000 (02:04 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:12 +0000 (19:30 -0700)
commit972b89c1f05f49bac53ea977d20b49330b81b0fa
tree9e8d3825fb093df0fc6f01ed29c254814a4d85cb
parente5d896703d1318d539a972ff01dc887c124af427
mm/mm_init.c: simplify logic of deferred_[init|free]_pages

Function deferred_[init|free]_pages are only used in
deferred_init_maxorder(), which makes sure the range to init/free is
within MAX_ORDER_NR_PAGES size.

With this knowledge, we can simplify these two functions. Since

  * only the first pfn could be IS_MAX_ORDER_ALIGNED()

Also since the range passed to deferred_[init|free]_pages is always from
memblock.memory for those we have already allocated memmap to cover,
pfn_valid() always return true.  Then we can remove related check.

[richard.weiyang@gmail.com: adjust function declaration indention per David]
Link: https://lkml.kernel.org/r/20240613114525.27528-1-richard.weiyang@gmail.com
Link: https://lkml.kernel.org/r/20240612020421.31975-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mm_init.c