mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Yuan Liu <yuan1.liu@intel.com>,
	Oscar Salvador <osalvador@suse.de>,
	Mike Rapoport <rppt@kernel.org>,
	Wei Yang <richard.weiyang@gmail.com>
Cc: linux-mm@kvack.org, Nanhai Zou <nanhai.zou@intel.com>,
	Chen Zhang <zhangchen.kidd@jd.com>,
	Jason Zeng <jason.zeng@intel.com>, Chen Yu <yu.c.chen@intel.com>,
	Pan Deng <pan.deng@intel.com>, Tianyou Li <tianyou.li@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v9 0/2] mm/memory_hotplug: optimize zone contiguous check when changing pfn range
Date: Mon, 14 Sep 2026 12:45:52 +0200	[thread overview]
Message-ID: <88ded4c5-9181-41fe-9f31-e76910e58f85@kernel.org> (raw)
In-Reply-To: <20260914072929.1883794-1-yuan1.liu@intel.com>

On 9/14/26 09:29, Yuan Liu wrote:
> This series introduces a pages_with_online_memmap member into struct
> zone to avoid pageblock-by-pageblock scans across the entire zone and
> improve memory hotplug performance.
> 
> Approach
> ========
> Add a new zone member, pages_with_online_memmap, that tracks the
> number of pages within the zone span that have an online memory map,
> including present pages and memory holes whose memory map has been
> initialized and for which pfn_to_online_page() succeeds.
> 
> For early boot memory, pages_with_online_memmap is calculated in
> memmap_init_zone_range(). PFNs initialized by memmap_init_range() are
> included in pages_with_online_memmap, and hole PFNs for which
> pfn_to_online_page() succeeds are also counted in
> init_unavailable_range(). For hotplugged memory,
> pages_with_online_memmap is updated through adjust_present_page_count(),
> which is called during memory online and offline operations. When
> spanned_pages == pages_with_online_memmap, every PFN in the zone span
> has a valid memmap entry, so pfn_to_page() can be called for any PFN
> within the zone span without an additional pfn_valid() check.
> 
> The counter may temporarily undercount when pages with an online
> memory map exist outside the current zone span. This can only happen
> during boot, when initializing the memory map of pages that do not
> fall into any zone span. Growing the zone to cover such pages and
> later shrinking it back may result in a value that is too small.
> This is safe, as it merely prevents detecting a contiguous zone.
> 
> The contiguity check using pages_with_online_memmap is stricter than
> the old pageblock-by-pageblock scan. The old set_zone_contiguous()
> iterated at pageblock granularity via pageblock_pfn_to_page(), so a
> zone could be marked contiguous even if a subsection-sized hole
> existed within a pageblock. The new check requires
> spanned_pages == pages_with_online_memmap, meaning every PFN in the
> zone span must satisfy pfn_to_online_page().
> 
> Performance
> ===========
> 1. For VM hotplug performance data, please refer to Patch 2.
> 2. This series also benefits CXL hotplug. Performance results are
>    as follows
>    https://lore.kernel.org/all/20260409023552.GA2807@AE/
> 
> Tested cases
> ============
> 1. Hotplug/unplug correctness with both online_movable and online
>    policies, including partial unplug, middle-block offline gaps, and
>    edge-block span shrink.
> 2. Large scale (256G/512G) plug/unplug performance.
> 3. Boot-time subsection holes (aligned/unaligned, in-zone and
>    cross-zone) with correct pages_with_online_memmap accounting.
> 4. kernelcore=mirror: verified no overcounting.
> 
> Patch overview
> ==============
> Patch 1 makes shrink_zone_span() more robust when memory/hole boundary
> falls within a subsection. It checks the full subsection range to avoid
> incorrectly shrinking the zone span during memory unplug.
> 
> Patch 2 introduces pages_with_online_memmap to replace
> pageblock-by-pageblock scans across the entire zone for zone contiguity
> checks.

Sashiko seems to be heavy. I'll wait some more to get more review feedback (and
an Ack from Mike on the mm-init things) before I'll pick this up.

-- 
Cheers,

David

      parent reply	other threads:[~2026-09-14 10:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  7:29 Yuan Liu
2026-09-14  7:29 ` [PATCH v9 1/2] mm/memory_hotplug: make shrink_zone_span() more robust Yuan Liu
2026-09-14  7:29 ` [PATCH v9 2/2] mm/memory_hotplug: optimize zone contiguous check when changing pfn range Yuan Liu
2026-09-14 10:45 ` David Hildenbrand (Arm) [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=88ded4c5-9181-41fe-9f31-e76910e58f85@kernel.org \
    --to=david@kernel.org \
    --cc=jason.zeng@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nanhai.zou@intel.com \
    --cc=osalvador@suse.de \
    --cc=pan.deng@intel.com \
    --cc=richard.weiyang@gmail.com \
    --cc=rppt@kernel.org \
    --cc=tianyou.li@intel.com \
    --cc=yu.c.chen@intel.com \
    --cc=yuan1.liu@intel.com \
    --cc=zhangchen.kidd@jd.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

all inboxes | Powered by JetHome®