From: Wei Yang <richard.weiyang@gmail.com>
To: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Wei Yang <richard.weiyang@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
David Hildenbrand <david@redhat.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-s390 <linux-s390@vger.kernel.org>
Subject: Re: [PATCH v2] mm: fix accounting of memmap pages for early sections
Date: Wed, 6 Aug 2025 14:31:03 +0000 [thread overview]
Message-ID: <20250806143103.xkdz4sinbhcq4vyd@master> (raw)
In-Reply-To: <aJNOs0IB1d33GSSW@li-2b55cdcc-350b-11b2-a85c-a78bff51fc11.ibm.com>
On Wed, Aug 06, 2025 at 02:46:43PM +0200, Sumanth Korikkar wrote:
>> 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?
>
Looks reasonable to me.
>> 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
--
Wei Yang
Help you, Help me
prev parent reply other threads:[~2025-08-06 14:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 15:13 Sumanth Korikkar
2025-08-04 15:24 ` David Hildenbrand
2025-08-06 9:03 ` Wei Yang
2025-08-06 12:46 ` Sumanth Korikkar
2025-08-06 14:31 ` Wei Yang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250806143103.xkdz4sinbhcq4vyd@master \
--to=richard.weiyang@gmail.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=sumanthk@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox