[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250806143103.xkdz4sinbhcq4vyd@master>
Date: Wed, 6 Aug 2025 14:31:03 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: Sumanth Korikkar <sumanthk@...ux.ibm.com>
Cc: Wei Yang <richard.weiyang@...il.com>,
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
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
Powered by blists - more mailing lists