From: "Simon Wang (王传国)" <wangchuanguo@inspur.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"mhiramat@kernel.org" <mhiramat@kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: migrate: restore the nmask after successfully allocating on the target node
Date: Wed, 26 Mar 2025 05:54:35 +0000 [thread overview]
Message-ID: <9e14314cd04645409699ece39443765a@inspur.com> (raw)
> On Wed, Mar 26, 2025 at 11:12:18AM +0800, wangchuanguo wrote:
> > If memory is successfully allocated on the target node and the
> > function directly returns without value restore for nmask, non-first
> > migration operations in migrate_pages() by again label may ignore the
> > nmask settings, thereby allowing new memory allocations for migration
> > on any node.
>
> I have no opinion on whether this is the right thing to do or not, but if it is
>
I don't think so. When memory allocation fails on the target node, there is already a recovery operation for the nmask value below. Therefore, the nmask value should only be restored when memory allocation is successfully completed on the target node.
> > +++ b/mm/vmscan.c
> > @@ -1026,8 +1026,10 @@ struct folio *alloc_migrate_folio(struct folio *src,
> unsigned long private)
> > mtc->nmask = NULL;
> > mtc->gfp_mask |= __GFP_THISNODE;
> > dst = alloc_migration_target(src, (unsigned long)mtc);
> > - if (dst)
> > + if (dst) {
> > + mtc->nmask = allowed_mask;
> > return dst;
> > + }
> >
> > mtc->gfp_mask &= ~__GFP_THISNODE;
> > mtc->nmask = allowed_mask;
>
> this should be:
>
> dst = alloc_migration_target(src, (unsigned long)mtc);
> + mtc->nmask = allowed_mask;
> if (dst)
> return dst;
>
> mtc->gfp_mask &= ~__GFP_THISNODE;
> - mtc->nmask = allowed_mask;
next reply other threads:[~2025-03-26 5:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 5:54 Simon Wang (王传国) [this message]
2025-03-28 13:41 ` [PATCH] mm: migrate: restore the nmask after successfully allocating on the target node Oscar Salvador
-- strict thread matches above, loose matches on Subject: below --
2025-04-01 1:06 Simon Wang (王传国)
2025-04-01 0:48 Simon Wang (王传国)
2025-03-26 3:12 wangchuanguo
2025-03-26 3:28 ` Matthew Wilcox
2025-03-28 13:44 ` Oscar Salvador
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=9e14314cd04645409699ece39443765a@inspur.com \
--to=wangchuanguo@inspur.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhiramat@kernel.org \
--cc=willy@infradead.org \
/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