mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: "Liu, Yuan1" <yuan1.liu@intel.com>
Cc: David Hildenbrand <david@kernel.org>,
	Oscar Salvador <osalvador@suse.de>,
	Wei Yang <richard.weiyang@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"Zou, Nanhai" <nanhai.zou@intel.com>,
	Chen Zhang <zhangchen.kidd@jd.com>,
	"Zeng, Jason" <jason.zeng@intel.com>,
	"Chen, Yu C" <yu.c.chen@intel.com>,
	"Deng, Pan" <pan.deng@intel.com>,
	"Li, Tianyou" <tianyou.li@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v9 2/2] mm/memory_hotplug: optimize zone contiguous check when changing pfn range
Date: Tue, 15 Sep 2026 15:52:20 +0300	[thread overview]
Message-ID: <aqk_hNZCVCyx5Mj_@kernel.org> (raw)
In-Reply-To: <PH7PR11MB69325D48C3419508FFD8B8BEA3BA2@PH7PR11MB6932.namprd11.prod.outlook.com>

On Tue, Sep 15, 2026 at 10:40:01AM +0000, Liu, Yuan1 wrote:
> > -----Original Message-----
> > From: Mike Rapoport <rppt@kernel.org>
> > Sent: Tuesday, September 15, 2026 2:04 PM
> > To: Liu, Yuan1 <yuan1.liu@intel.com>
> > Cc: David Hildenbrand <david@kernel.org>; Oscar Salvador
> > <osalvador@suse.de>; Wei Yang <richard.weiyang@gmail.com>; linux-
> > mm@kvack.org; Zou, Nanhai <nanhai.zou@intel.com>; Chen Zhang
> > <zhangchen.kidd@jd.com>; Zeng, Jason <jason.zeng@intel.com>; Chen, Yu C
> > <yu.c.chen@intel.com>; Deng, Pan <pan.deng@intel.com>; Li, Tianyou
> > <tianyou.li@intel.com>; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v9 2/2] mm/memory_hotplug: optimize zone contiguous
> > check when changing pfn range
> > 
> > Hi,
> > 
> > On Mon, Sep 14, 2026 at 03:29:29AM -0400, Yuan Liu wrote:
> > > When move_pfn_range_to_zone() or remove_pfn_range_from_zone() updates a
> > > zone, set_zone_contiguous() rescans the entire zone pageblock-by-
> > pageblock
> > > to rebuild zone->contiguous. For large zones this is a significant cost
> > > during memory hotplug and hot-unplug.
> > >
> > > diff --git a/mm/mm_init.c b/mm/mm_init.c
> > > index 1533aebafb68..d40a8ff23370 100644
> > > --- a/mm/mm_init.c
> > > +++ b/mm/mm_init.c
> > > @@ -817,22 +817,39 @@ void __meminit init_deferred_page(unsigned long
> > pfn, int nid)
> > >   *   zone/node above the hole except for the trailing pages in the last
> > >   *   section that will be appended to the zone/node below.
> > >   */
> > > -static void __init init_unavailable_range(unsigned long spfn,
> > > -					  unsigned long epfn,
> > > -					  int zone, int node)
> > > +static unsigned long __init init_unavailable_range(unsigned long spfn,
> > > +						   unsigned long epfn,
> > > +						   int zone, int node)
> > >  {
> > > +	unsigned long next_chunk_pfn __maybe_unused = spfn;
> > >  	unsigned long pfn;
> > > -	u64 pgcnt = 0;
> > > +	u64 online_pgcnt = 0, pgcnt = 0;
> > > +	bool is_online = true;
> > >
> > >  	for_each_valid_pfn(pfn, spfn, epfn) {
> > >  		__init_single_page(pfn_to_page(pfn), pfn, zone, node);
> > >  		__SetPageReserved(pfn_to_page(pfn));
> > >  		pgcnt++;
> > > +
> > > +		/*
> > > +		 * With vmemmap, at this stage all pages in an early section
> > > +		 * have a valid memmap and are marked as online. However, only
> > > +		 * subsections in the subsection map are actually online.
> > > +		 */
> > 
> > I'm having trouble parsing this comment. Shouldn't is say that some
> > subsections in a section can be offline because of holes?
> > 
> > Other than that
> > 
> > Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> 
> Maybe we could add some more comments here
> /*
>  * With vmemmap, at this stage all pages in an early section
>  * have a valid memmap and are marked as online. However,
>  * subsection-sized holes within a section are offline, only
>  * subsections in the subsection map are actually online.
>  */

I don't see how adding almost identical cryptic comment in another place
helps.
 
> > > +#ifdef CONFIG_SPARSEMEM_VMEMMAP
> > > +		if (pfn >= next_chunk_pfn) {
> > > +			is_online = pfn_section_valid(__pfn_to_section(pfn),
> > pfn);
> > > +			next_chunk_pfn = min(SUBSECTION_ALIGN_UP(pfn + 1),
> > epfn);
> > > +		}
> > > +#endif
> > > +		if (is_online)
> > > +			online_pgcnt++;
> > >  	}
> > >
> > >  	if (pgcnt)
> > >  		pr_info("On node %d, zone %s: %lld pages in unavailable
> > ranges\n",
> > >  			node, zone_names[zone], pgcnt);
> > > +	return online_pgcnt;
> > >  }
> > >
> > >  /*
> > 
> > --
> > Sincerely yours,
> > Mike.

-- 
Sincerely yours,
Mike.

  reply	other threads:[~2026-09-15 12:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  7:29 [PATCH v9 0/2] " 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-15  6:03   ` Mike Rapoport
2026-09-15 10:40     ` Liu, Yuan1
2026-09-15 12:52       ` Mike Rapoport [this message]
2026-09-15 15:20     ` David Hildenbrand (Arm)
2026-09-15 18:58       ` Mike Rapoport
2026-09-14 10:45 ` [PATCH v9 0/2] " David Hildenbrand (Arm)

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=aqk_hNZCVCyx5Mj_@kernel.org \
    --to=rppt@kernel.org \
    --cc=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=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®