diff mbox series

mm/mm_init: Fix the zone->managed_pages comment to match the code

Message ID 20241229180900.49920-1-jiwen7.qi@gmail.com (mailing list archive)
State New
Headers show
Series mm/mm_init: Fix the zone->managed_pages comment to match the code | expand

Commit Message

Jiwen Qi Dec. 29, 2024, 6:09 p.m. UTC
The invocation of zone_init_internals(zone, j, nid, zone->present_pages)
initializes zone->managed_pages to zone->present_pages. zone->present_pages
is not 0 when the zone is not empty.

Signed-off-by: Jiwen Qi <jiwen7.qi@gmail.com>
---
 mm/mm_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


base-commit: 4bbf9020becbfd8fc2c3da790855b7042fad455b

Comments

David Hildenbrand Jan. 9, 2025, 2:28 p.m. UTC | #1
On 29.12.24 19:09, Jiwen Qi wrote:
> The invocation of zone_init_internals(zone, j, nid, zone->present_pages)
> initializes zone->managed_pages to zone->present_pages. zone->present_pages
> is not 0 when the zone is not empty.
> 
> Signed-off-by: Jiwen Qi <jiwen7.qi@gmail.com>
> ---
>   mm/mm_init.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 24b68b425afb..6cf6243c4c52 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -1567,8 +1567,9 @@ static void __init free_area_init_core(struct pglist_data *pgdat)
>   		unsigned long size = zone->spanned_pages;
>   
>   		/*
> -		 * Initialize zone->managed_pages as 0 , it will be reset
> -		 * when memblock allocator frees pages into buddy system.
> +		 * Initialize zone->managed_pages to zone->present_pages, it
> +		 * will be reset when memblock allocator frees pages into
> +		 * buddy system.


Maybe we can be a bit clearer:

"Initialize zone->managed_pages to zone->present_pages as a first rough 
estimate. memblock_free_all() will reset zone->managed_pages to 0, and
calculate the actual managed pages as they are freed to the buddy."

?

It might also make sense to mention commit 0ac5e785dcb797 in the patch 
description, that contains some more details.
diff mbox series

Patch

diff --git a/mm/mm_init.c b/mm/mm_init.c
index 24b68b425afb..6cf6243c4c52 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -1567,8 +1567,9 @@  static void __init free_area_init_core(struct pglist_data *pgdat)
 		unsigned long size = zone->spanned_pages;
 
 		/*
-		 * Initialize zone->managed_pages as 0 , it will be reset
-		 * when memblock allocator frees pages into buddy system.
+		 * Initialize zone->managed_pages to zone->present_pages, it
+		 * will be reset when memblock allocator frees pages into
+		 * buddy system.
 		 */
 		zone_init_internals(zone, j, nid, zone->present_pages);