All of lore.kernel.org
 help / color / mirror / Atom feed
From: Muchun Song <muchun.song@linux.dev>
To: Mike Rapoport <rppt@kernel.org>
Cc: Muchun Song <songmuchun@bytedance.com>,
	Alexander Potapenko <glider@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Marco Elver <elver@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	David Hildenbrand <david@kernel.org>,
	"Liam R . Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Brendan Jackman <brendan.jackman@linux.dev>,
	Zi Yan <ziy@nvidia.com>, Joerg Roedel <joerg.roedel@amd.com>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	Pranjal Shrivastava <praan@google.com>,
	Ketan <ketan.kishore@oss.qualcomm.com>,
	Mostafa Saleh <smostafa@google.com>,
	Sang-Heon Jeon <ekffu200098@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Sashiko <sashiko-bot@kernel.org>,
	kasan-dev@googlegroups.com, workflows@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Chris Down <chris@chrisdown.name>
Subject: Re: [PATCH v2 5/7] mm/page_ext: allocate page extensions early for SPARSEMEM
Date: Wed, 18 Nov 2026 23:37:57 +0800	[thread overview]
Message-ID: <2e9faec6-9152-40ec-8c63-f262dc26e059@linux.dev> (raw)
In-Reply-To: <av2zkUpYGmGWPx8T@kernel.org>



On 2026/11/18 22:17, Mike Rapoport wrote:
> On Tue, Nov 17, 2026 at 11:00:06PM -0800, Chris Down wrote:
>> Hi Muchun,
>>
>> Muchun Song writes:
>>> Mike's suggestion considerably simplifies the code, and early page_ext is
>>> only needed by optional debugging and instrumentation users. I would prefer
>>> to keep this approach.
>> You're probably right.
> I think so :)
> The memap_alloc() that essentially allocates the memory map does
>
> 	memblock_alloc_try_nid_raw(size, align, min_addr,
> 				   MEMBLOCK_ALLOC_NOLEAKTRACE, nid);
>
> so we anyway may end up with reserved memory in ZONE_MOVABLE.
>
> Until recently we had memory map allocation before the zones were setup, so
> there wasn't much we could do about it, but ...
>
>> But can I cheekily suggest something in the middle perhaps? :-)
>>
>> Given the zones are already set up before page_ext_alloc() runs, perhaps
>> you can pass the start of the node's ZONE_MOVABLE as max_addr to
>> memblock_alloc_try_nid() when the node has one. The general idea is:
>>
>>      struct zone *movable = &NODE_DATA(nid)->node_zones[ZONE_MOVABLE];
>>      phys_addr_t max_addr = MEMBLOCK_ALLOC_ACCESSIBLE;
>>
>>      if (!zone_is_empty(movable))
>>              max_addr = PFN_PHYS(movable->zone_start_pfn);
>>      addr = memblock_alloc_try_nid(size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS),
>>                                    max_addr, nid);
>>      if (!addr && max_addr != MEMBLOCK_ALLOC_ACCESSIBLE)
>>              addr = memblock_alloc_try_nid(size, PAGE_SIZE,
>>                                            __pa(MAX_DMA_ADDRESS),
>>                                            MEMBLOCK_ALLOC_ACCESSIBLE, nid);
> ... with zone extents known we could take it even further :)
>
> page_ext is treated as the memory map in many ways, so we can allocate the
> early page_ext sections with memmap_alloc().
> And since the latter always runs after zones are set up it could include
> this change.
>
> But I think this should come as a separate series that also could move
> memmap_boot_pages_add to memmap_alloc().

Agreed. Using memmap_alloc() for early page_ext allocations and
teaching it to avoid ZONE_MOVABLE sounds cleaner. I'll keep this
series as is and handle that in a separate series.

Thanks!

>   
>> I briefly tried that and it seems to work quite nicely.
>>
>> But I don't object to it even without that, so feel free to add either way:
>>
>> Reviewed-by: Chris Down <chris@chrisdown.name>
>>
>> Thanks!
>>
>> Chris


  reply	other threads:[~2026-11-18 15:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 12:06 [PATCH v2 0/7] KMSAN: Move per-page metadata out of struct page Muchun Song
2026-11-17 12:06 ` [PATCH v2 1/7] kmsan: encapsulate per-page metadata access Muchun Song
2026-11-17 12:06 ` [PATCH v2 2/7] mm/page_ext: fix client data alignment Muchun Song
2026-11-17 19:36   ` sashiko-bot
2026-11-17 19:46     ` Andrew Morton
2026-11-18  3:49       ` Muchun Song
2026-11-18  4:21         ` Andrew Morton
2026-11-18  5:39           ` Muchun Song
2026-11-18  5:51             ` Andrew Morton
2026-11-18  5:57               ` Muchun Song
2026-11-18 13:40             ` Mike Rapoport
2026-11-18 15:03               ` Muchun Song
2026-11-17 12:06 ` [PATCH v2 3/7] mm/page_ext: always use vmalloc for section page extensions Muchun Song
2026-11-18 13:43   ` Mike Rapoport
2026-11-17 12:06 ` [PATCH v2 4/7] mm/page_ext: use common allocation and initialization entry points Muchun Song
2026-11-18 14:18   ` Mike Rapoport
2026-11-17 12:06 ` [PATCH v2 5/7] mm/page_ext: allocate page extensions early for SPARSEMEM Muchun Song
2026-11-18  0:06   ` Chris Down
2026-11-18  3:11     ` Muchun Song
2026-11-18  7:00       ` Chris Down
2026-11-18 14:17         ` Mike Rapoport
2026-11-18 15:37           ` Muchun Song [this message]
2026-11-18 14:22   ` Mike Rapoport
2026-11-18 15:13     ` Muchun Song
2026-11-18 19:03       ` Mike Rapoport
2026-11-17 12:06 ` [PATCH v2 6/7] mm/page_ext: inline unchecked page extension lookup Muchun Song
2026-11-17 12:06 ` [PATCH v2 7/7] kmsan: fix metadata loss during HugeTLB struct page reinitialization Muchun Song
2026-11-18  0:06 ` [PATCH v2 0/7] KMSAN: Move per-page metadata out of struct page Chris Down
2026-11-18  3:12   ` Muchun Song

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=2e9faec6-9152-40ec-8c63-f262dc26e059@linux.dev \
    --to=muchun.song@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=brendan.jackman@linux.dev \
    --cc=chris@chrisdown.name \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=dvyukov@google.com \
    --cc=ekffu200098@gmail.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=joerg.roedel@amd.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=ketan.kishore@oss.qualcomm.com \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=praan@google.com \
    --cc=rdunlap@infradead.org \
    --cc=rppt@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=smostafa@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --cc=workflows@vger.kernel.org \
    --cc=ziy@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.