From: "Liu, Yuan1" <yuan1.liu@intel.com>
To: Mike Rapoport <rppt@kernel.org>
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>,
"Hu, Yong" <yong.hu@intel.com>,
"Zou, Nanhai" <nanhai.zou@intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
"Zhuo, Qiuxu" <qiuxu.zhuo@intel.com>,
"Chen, Yu C" <yu.c.chen@intel.com>,
"Deng, Pan" <pan.deng@intel.com>,
"Li, Tianyou" <tianyou.li@intel.com>,
Chen Zhang <zhangchen.kidd@jd.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] mm/memory hotplug/unplug: Optimize zone contiguous check when changing pfn range
Date: Thu, 26 Mar 2026 07:32:53 +0000 [thread overview]
Message-ID: <IA4PR11MB9009187EED35C9F23F476838A356A@IA4PR11MB9009.namprd11.prod.outlook.com> (raw)
In-Reply-To: <acEpLz9zfAF6gS05@kernel.org>
> -----Original Message-----
> From: Mike Rapoport <rppt@kernel.org>
> Sent: Monday, March 23, 2026 7:51 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; Hu, Yong <yong.hu@intel.com>; Zou, Nanhai
> <nanhai.zou@intel.com>; Tim Chen <tim.c.chen@linux.intel.com>; Zhuo, Qiuxu
> <qiuxu.zhuo@intel.com>; Chen, Yu C <yu.c.chen@intel.com>; Deng, Pan
> <pan.deng@intel.com>; Li, Tianyou <tianyou.li@intel.com>; Chen Zhang
> <zhangchen.kidd@jd.com>; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] mm/memory hotplug/unplug: Optimize zone contiguous
> check when changing pfn range
>
> Hi,
>
> On Thu, Mar 19, 2026 at 05:56:22AM -0400, Yuan Liu wrote:
>
> ...
>
> > diff --git a/mm/mm_init.c b/mm/mm_init.c
> > index df34797691bd..96690e550024 100644
> > --- a/mm/mm_init.c
> > +++ b/mm/mm_init.c
> > @@ -946,6 +946,7 @@ static void __init memmap_init_zone_range(struct
> zone *zone,
> > unsigned long zone_start_pfn = zone->zone_start_pfn;
> > unsigned long zone_end_pfn = zone_start_pfn + zone->spanned_pages;
> > int nid = zone_to_nid(zone), zone_id = zone_idx(zone);
> > + unsigned long zone_hole_start, zone_hole_end;
> >
> > start_pfn = clamp(start_pfn, zone_start_pfn, zone_end_pfn);
> > end_pfn = clamp(end_pfn, zone_start_pfn, zone_end_pfn);
> > @@ -957,8 +958,19 @@ static void __init memmap_init_zone_range(struct
> zone *zone,
> > zone_end_pfn, MEMINIT_EARLY, NULL, MIGRATE_MOVABLE,
> > false);
> >
> > - if (*hole_pfn < start_pfn)
> > + WRITE_ONCE(zone->pages_with_online_memmap,
> > + READ_ONCE(zone->pages_with_online_memmap) +
> > + (end_pfn - start_pfn));
> > +
> > + if (*hole_pfn < start_pfn) {
> > init_unavailable_range(*hole_pfn, start_pfn, zone_id, nid);
> > + zone_hole_start = clamp(*hole_pfn, zone_start_pfn,
> zone_end_pfn);
> > + zone_hole_end = clamp(start_pfn, zone_start_pfn,
> zone_end_pfn);
> > + if (zone_hole_start < zone_hole_end)
> > + WRITE_ONCE(zone->pages_with_online_memmap,
> > + READ_ONCE(zone->pages_with_online_memmap) +
> > + (zone_hole_end - zone_hole_start));
> > + }
>
> I didn't have time to review it, but it really jumped at me.
> memmap_init_zone_range() runs before SMP, there is no need for
> WRITE_ONCE()/READ_ONCE() here.
Hi Mike
Thank you very much for taking the time to review this patch. I will fix it.
> --
> Sincerely yours,
> Mike.
prev parent reply other threads:[~2026-03-26 7:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 9:56 [PATCH] mm/memory hotplug/unplug: Optimize zone contiguous check when changing pfn range Yuan Liu
2026-03-19 10:08 ` Liu, Yuan1
2026-03-20 3:13 ` Andrew Morton
2026-03-23 10:56 ` David Hildenbrand (Arm)
2026-03-23 11:31 ` Mike Rapoport
2026-03-23 11:42 ` David Hildenbrand (Arm)
2026-03-26 7:30 ` Liu, Yuan1
2026-03-26 7:38 ` Chen, Yu C
2026-03-26 9:53 ` David Hildenbrand (Arm)
2026-03-26 3:39 ` Liu, Yuan1
2026-03-26 9:23 ` David Hildenbrand (Arm)
2026-03-23 11:51 ` Mike Rapoport
2026-03-26 7:32 ` Liu, Yuan1 [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=IA4PR11MB9009187EED35C9F23F476838A356A@IA4PR11MB9009.namprd11.prod.outlook.com \
--to=yuan1.liu@intel.com \
--cc=david@kernel.org \
--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=qiuxu.zhuo@intel.com \
--cc=richard.weiyang@gmail.com \
--cc=rppt@kernel.org \
--cc=tianyou.li@intel.com \
--cc=tim.c.chen@linux.intel.com \
--cc=yong.hu@intel.com \
--cc=yu.c.chen@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