From: Oscar Salvador <osalvador@suse.de>
To: David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
Wei Yang <richard.weiyang@gmail.com>,
Miaohe Lin <linmiaohe@huawei.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm/memory_hotplug: Reset node's state when empty during offline
Date: Thu, 5 May 2022 12:37:46 +0200 [thread overview]
Message-ID: <YnOo+nSCqMw0gWXB@localhost.localdomain> (raw)
In-Reply-To: <0d2853f6-66e5-251a-2d9e-c229f0ebcd5e@redhat.com>
On Thu, Apr 28, 2022 at 02:30:20PM +0200, David Hildenbrand wrote:
> On 07.03.22 16:07, Oscar Salvador wrote:
> > +static void node_reset_state(int node)
> > +{
> > + pg_data_t *pgdat = NODE_DATA(node);
> > + int cpu;
> > +
> > + kswapd_stop(node);
> > + kcompactd_stop(node);
> > +
> > + reset_node_managed_pages(pgdat);
> > + reset_node_present_pages(pgdat);
> > +
> > + pgdat->nr_zones = 0;
> > + pgdat->kswapd_order = 0;
> > + pgdat->kswapd_highest_zoneidx = 0;
> > + pgdat->node_start_pfn = 0;
>
>
> I'm confused why we have to mess with
> * present pages
> * managed pages
> * node_start_pfn
>
> here at all.
>
> 1) If there would be any present page left, calling node_reset_state()
> would be a BUG.
> 2) If there would be any manged page left, calling node_reset_state()
> would be a BUG.
> 3) node_start_pfn will be properly updated by
> remove_pfn_range_from_zone()->update_pgdat_span()
Yes, you are right, trusting update_pgdat_span() is the right to do
here.
> To make it clearer, I *think* touching node_start_pfn is very wrong.
>
> What if the node still has ZONE_DEVICE? They don't account towards
> present pages but only towards spanned pages, and we're messing with the
> start range.
Did not think of that scenario, but as you said, we should be leaving
node/zone's pages accounting alone here.
> remove_pfn_range_from_zone()->update_pgdat_span() should be the only
> place that modifies the spanned range when offlining.
Will update the patch.
Thanks for the review David!
--
Oscar Salvador
SUSE Labs
next prev parent reply other threads:[~2022-05-05 10:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-07 15:07 [PATCH 0/3] A minor hotplug refactoring Oscar Salvador
2022-03-07 15:07 ` [PATCH 1/3] mm/page_alloc: Do not calculate node's total pages and memmap pages when empty Oscar Salvador
2022-04-28 12:13 ` David Hildenbrand
2022-05-05 9:09 ` Oscar Salvador
2022-03-07 15:07 ` [PATCH 2/3] mm/memory_hotplug: Reset node's state when empty during offline Oscar Salvador
2022-04-28 12:30 ` David Hildenbrand
2022-05-05 10:37 ` Oscar Salvador [this message]
2022-03-07 15:07 ` [PATCH 3/3] mm/memory_hotplug: Refactor hotadd_init_pgdat and try_online_node Oscar Salvador
2022-04-28 12:35 ` David Hildenbrand
2022-05-05 9:17 ` Oscar Salvador
2022-04-27 21:05 ` [PATCH 0/3] A minor hotplug refactoring Andrew Morton
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=YnOo+nSCqMw0gWXB@localhost.localdomain \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=richard.weiyang@gmail.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;
as well as URLs for NNTP newsgroup(s).