diff options
| author | Sumanth Korikkar <[email protected]> | 2025-08-07 18:35:45 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-08-28 05:45:43 +0000 |
| commit | c3576889d87b603cb66b417e08844a53c1077a37 (patch) | |
| tree | 8b7a41c86d02281522b376043422c2417f9dfd5b /mm/sparse-vmemmap.c | |
| parent | mm/damon/core: prevent unnecessary overflow in damos_set_effective_quota() (diff) | |
| download | kernel-c3576889d87b603cb66b417e08844a53c1077a37.tar.gz kernel-c3576889d87b603cb66b417e08844a53c1077a37.zip | |
mm: fix accounting of memmap pages
For !CONFIG_SPARSEMEM_VMEMMAP, memmap page accounting is currently done
upfront in sparse_buffer_init(). However, sparse_buffer_alloc() may
return NULL in failure scenario.
Also, memmap pages may be allocated either from the memblock allocator
during early boot or from the buddy allocator. When removed via
arch_remove_memory(), accounting of memmap pages must reflect the original
allocation source.
To ensure correctness:
* Account memmap pages after successful allocation in sparse_init_nid()
and section_activate().
* Account memmap pages in section_deactivate() based on allocation
source.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 15995a352474 ("mm: report per-page metadata information")
Signed-off-by: Sumanth Korikkar <[email protected]>
Suggested-by: David Hildenbrand <[email protected]>
Reviewed-by: Wei Yang <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Gerald Schaefer <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/sparse-vmemmap.c')
| -rw-r--r-- | mm/sparse-vmemmap.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index fd2ab5118e13..41aa0493eb03 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -578,11 +578,6 @@ struct page * __meminit __populate_section_memmap(unsigned long pfn, if (r < 0) return NULL; - if (system_state == SYSTEM_BOOTING) - memmap_boot_pages_add(DIV_ROUND_UP(end - start, PAGE_SIZE)); - else - memmap_pages_add(DIV_ROUND_UP(end - start, PAGE_SIZE)); - return pfn_to_page(pfn); } |
