[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXhk2F3gSXHnCo5s@kernel.org>
Date: Tue, 27 Jan 2026 09:10:16 +0200
From: Mike Rapoport <rppt@...nel.org>
To: "Li, Tianyou" <tianyou.li@...el.com>
Cc: David Hildenbrand <david@...nel.org>,
Oscar Salvador <osalvador@...e.de>,
Wei Yang <richard.weiyang@...il.com>,
Michal Hocko <mhocko@...e.com>, linux-mm@...ck.org,
Yong Hu <yong.hu@...el.com>, Nanhai Zou <nanhai.zou@...el.com>,
Yuan Liu <yuan1.liu@...el.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Qiuxu Zhuo <qiuxu.zhuo@...el.com>, Yu C Chen <yu.c.chen@...el.com>,
Pan Deng <pan.deng@...el.com>, Chen Zhang <zhangchen.kidd@...com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 3/3] mm/memory hotplug/unplug: Optimize
zone->contiguous update when changes pfn range
Hi,
On Sat, Jan 24, 2026 at 08:43:51PM +0800, Li, Tianyou wrote:
> On 1/22/2026 7:43 PM, Mike Rapoport wrote:
>
> > > +int online_memory_block_pages(unsigned long start_pfn, unsigned long nr_pages,
> > > + unsigned long nr_vmemmap_pages, struct zone *zone,
> > > + struct memory_group *group)
> > > {
> > > + const bool contiguous = zone->contiguous;
> > > + enum zone_contig_state new_contiguous_state;
> > > int ret;
> > > + /*
> > > + * Calculate the new zone contig state before move_pfn_range_to_zone()
> > > + * sets the zone temporarily to non-contiguous.
> > > + */
> > > + new_contiguous_state = zone_contig_state_after_growing(zone, start_pfn,
> > > + nr_pages);
> > > +
> > > if (nr_vmemmap_pages) {
> > > ret = mhp_init_memmap_on_memory(start_pfn, nr_vmemmap_pages, zone);
> > > if (ret)
> > > - return ret;
> > > + goto restore_zone_contig;
> > But zone_contig_state_after_growing() does not change zone->contiguous. Why
> > do we need to save and restore it?
>
> Move_pfn_range_to_zone() will clear the zone contiguous state and it was
> invoked by online_pages(). If error occurs after
> move_pfn_range_to_zone() called like in online_pages(), I think we'd better
> to restore the original value if previous zone contiguous state is true.
But after move_pfn_range_to_zone() the added pages are still offline, so I
think the zone remains contiguous and the call to
clear_zone_contiguous(zone) should not be there.
BTW, as we have set_zone_contiguous(ZONE_CONTIG_NO) I think we can use it
instead if clear_zone_contiguous() and remove the latter.
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists