[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <9e14314cd04645409699ece39443765a@inspur.com>
Date: Wed, 26 Mar 2025 05:54:35 +0000
From: Simon Wang (王传国) <wangchuanguo@...pur.com>
To: Matthew Wilcox <willy@...radead.org>
CC: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"mhiramat@...nel.org" <mhiramat@...nel.org>, "linux-mm@...ck.org"
<linux-mm@...ck.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: migrate: restore the nmask after successfully
allocating on the target node
> 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;
Powered by blists - more mailing lists