mm/mm_init.c: print mem_init info after defer_init is done
PATCH v2 1/1 mm/mm_init.c: print mem_init info after defer_init is done
Current call flow looks like this:
start_kernel
mm_core_init
mem_init
mem_init_print_info
rest_init
kernel_init
kernel_init_freeable
page_alloc_init_late
deferred_init_memmap
If CONFIG_DEFERRED_STRUCT_PAGE_INIT, the time mem_init_print_info() calls, pages are not totally initialized and freed to buddy.
This has one issue
* nr_free_pages() just contains partial free pages in the system, which is not we expect.
Let's print the mem info after defer_init is done.
Also this would help changing totalram_pages accounting, since we plan to move the accounting into __free_pages_core().
---
v2:
* mention this would help changing totalram_pages accounting
* instead of moving the function ahead, add function declaration ahead
* add a comment before calling mem_init_print_info
--- mm/mm_init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/mm_init.c +3 -1
@@ -2322,6 +2322,7 @@ void set_zone_contiguous(struct zone *zone) zone->contiguous = true; } +static void __init mem_init_print_info (void );void __init page_alloc_init_late (void ) {struct zone *zone;
@@ -2348,6 +2349,8 @@ void __init page_alloc_init_late(void)files_maxfiles_init ();#endif +/* Accounting of total+free memory is stable at this point. */ +mem_init_print_info ();buffer_init ();/* Discard memblock private memory */
@@ -2737,7 +2740,6 @@ void __init mm_core_init(void)kmsan_init_shadow ();stack_depot_early_init ();mem_init (); -mem_init_print_info ();kmem_cache_init ();/* * page_owner must be initialized after buddy is ready, and also after
Signature · 1 line
2.34.1
Quoted 20 lines · Wei Yang
Current call flow looks like this:
start_kernel
mm_core_init
mem_init
mem_init_print_info
rest_init
kernel_init
kernel_init_freeable
page_alloc_init_late
deferred_init_memmapIf
CONFIG_DEFERRED_STRUCT_PAGE_INIT, the timemem_init_print_info()calls, pages are not totally initialized and freed to buddy.This has one issue
*
nr_free_pages()just contains partial free pages in the system, which is not we expect.
Quoted 7 lines
Let's print the mem info after
defer_initis done.Also this would help changing
totalram_pagesaccounting, since we plan to move the accounting into__free_pages_core().Signed-off-by Wei Yang <[email protected]>CC David Hildenbrand <[email protected]>
Hoping this won't reveal other surprises.
Signature · 3 lines
Cheers, David / dhildenb
Quoted 26 lines · David Hildenbrand
Quoted 25 lines · Wei Yang
Current call flow looks like this:
start_kernel
mm_core_init
mem_init
mem_init_print_info
rest_init
kernel_init
kernel_init_freeable
page_alloc_init_late
deferred_init_memmapIf
CONFIG_DEFERRED_STRUCT_PAGE_INIT, the timemem_init_print_info()calls, pages are not totally initialized and freed to buddy.This has one issue
*
nr_free_pages()just contains partial free pages in the system, which is not we expect.Let's print the mem info after
defer_initis done.Also this would help changing
totalram_pagesaccounting, since we plan to move the accounting into__free_pages_core().
Quoted 7 lines
Quoted 2 lines
Signed-off-by Wei Yang <[email protected]>CC David Hildenbrand <[email protected]>Hoping this won't reveal other surprises.
:-)
Quoted 4 lines
Signature · 3 lines
Cheers, David / dhildenb
Signature · 2 lines
Wei Yang Help you, Help me