[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJNOs0IB1d33GSSW@li-2b55cdcc-350b-11b2-a85c-a78bff51fc11.ibm.com>
Date: Wed, 6 Aug 2025 14:46:43 +0200
From: Sumanth Korikkar <sumanthk@...ux.ibm.com>
To: Wei Yang <richard.weiyang@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
David Hildenbrand <david@...hat.com>,
Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
linux-s390 <linux-s390@...r.kernel.org>
Subject: Re: [PATCH v2] mm: fix accounting of memmap pages for early sections
> The change here is reasonable. While maybe we still miss the counting at some
> other points.
>
> For example:
>
> a.
>
> sparse_init_nid()
> __populate_section_memmap()
>
> If !CONFIG_SPARSEMEM_VMEMMAP, and sparse_buffer_alloc() return NULL, it
> allocate extra memory from bootmem, which looks not counted.
Currently, the accounting is done upfront in sparse_buffer_init(), where
memmap_boot_pages_add() is called for !CONFIG_SPARSEMEM_VMEMMAP.
The function sparse_buffer_alloc() can return NULL in two scenarios:
* During sparse_buffer_init(), if memmap_alloc() fails, sparsemap_buf will be NULL.
* Inside sparse_buffer_alloc(), if ptr + size exceeds sparsemap_buf_end,
then ptr is set to NULL.
Considering this, perhaps memmap_boot_pages_add() could be moved into
__populate_section_memmap(), with the accounting done only if the
operation is successful. What do you think?
> section_activate()
> populate_section_memmap()
>
> If !CONFIG_SPARSEMEM_VMEMMAP, it just call kvmalloc_node(), which looks not
> counted.
Sounds right. This means nr_memmap_pages adjustment is needed for
!CONFIG_SPARSEMEM_VMEMMAP here. I will recheck this.
Thank you
Powered by blists - more mailing lists