diff mbox series

[v2] mm/mm_init.c: don't initialize page->lru again

Message ID 20240610143742.26401-1-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series [v2] mm/mm_init.c: don't initialize page->lru again | expand

Commit Message

Wei Yang June 10, 2024, 2:37 p.m. UTC
Current page initialization call flow looks like this with some
simplification:

setup_arch()
  paging_init()
    free_area_init()
      memmap_init()
        memmap_init_zone_range()
	  memmap_init_range()
	    defer_init()
	    __init_single_page()
mm_core_init()
  mem_init()
    memblock_free_all()
      free_low_memory_core_early()
        memmap_init_reserved_pages()
          reserve_bootmem_region()
	    init_reserved_page()
	      __init_single_page()

There two cases depends on CONFIG_DEFERRED_STRUCT_PAGE_INIT.

  * If CONFIG_DEFERRED_STRUCT_PAGE_INIT, pages after first_init_pfn is
    skipped at defer_init(). Then init_reserved_page() is defined to
    call __init_single_page() for them.
  * If !CONFIG_DEFERRED_STRUCT_PAGE_INIT, pages are all initialized by
    memmap_init_range().

In both cases, after init_reserved_page(), we expect __init_single_page()
has done its work to the page, which already initialize page->lru properly.

We don't need to do it again.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

---
v2: adjust changelog to put the call flow in it
---
 mm/mm_init.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Mike Rapoport June 10, 2024, 3:13 p.m. UTC | #1
From: Mike Rapoport (IBM) <rppt@kernel.org>

On Mon, 10 Jun 2024 14:37:42 +0000, Wei Yang wrote:
> Current page initialization call flow looks like this with some
> simplification:
> 
> setup_arch()
>   paging_init()
>     free_area_init()
>       memmap_init()
>         memmap_init_zone_range()
> 	  memmap_init_range()
> 	    defer_init()
> 	    __init_single_page()
> mm_core_init()
>   mem_init()
>     memblock_free_all()
>       free_low_memory_core_early()
>         memmap_init_reserved_pages()
>           reserve_bootmem_region()
> 	    init_reserved_page()
> 	      __init_single_page()
> 
> [...]

Applied to for-next branch of memblock.git tree, thanks!

[1/1] mm/mm_init.c: don't initialize page->lru again
      commit: 0e9899feed9cbb7d33c01ad849dc307b1560b0ab

tree: https://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
branch: for-next

--
Sincerely yours,
Mike.
diff mbox series

Patch

diff --git a/mm/mm_init.c b/mm/mm_init.c
index 14133a1cfc7b..30379b0e7729 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -759,9 +759,6 @@  void __meminit reserve_bootmem_region(phys_addr_t start,
 
 			init_reserved_page(start_pfn, nid);
 
-			/* Avoid false-positive PageTail() */
-			INIT_LIST_HEAD(&page->lru);
-
 			/*
 			 * no need for atomic set_bit because the struct
 			 * page is not visible yet so nobody should