From: Zhongkun He <hezhongkun.hzk@bytedance.com>
To: Michal Hocko <mhocko@suse.com>
Cc: akpm@linux-foundation.org, mgorman@techsingularity.net,
hannes@cmpxchg.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, lizefan.x@bytedance.com
Subject: Re: [External] Re: [PATCH] mm:page_alloc: fix the NULL ac->nodemask in __alloc_pages_slowpath()
Date: Thu, 22 Aug 2024 14:39:47 +0800 [thread overview]
Message-ID: <CACSyD1OjnPU_CLbu9QNkbN41cGFmdwuzT8Kg4340Fk0MuUk+0w@mail.gmail.com> (raw)
In-Reply-To: <ZsbZsf2Z93_d9PQR@tiehlicka>
> > > Are you suggesting that the problem is that should_reclaim_retry is
> > > iterating nodes which are not allowed by cpusets and that makes the
> > > retry loop happening more than unnecessary?
> >
> > Yes, exactly.
> >
> > >
> > > Is there any reason why you haven't done the same that the page
> > > allocator does in this case?
> > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > > index 28f80daf5c04..cbf09c0e3b8a 100644
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -4098,6 +4098,11 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
> > > unsigned long min_wmark = min_wmark_pages(zone);
> > > bool wmark;
> > >
> > > + if (cpusets_enabled() &&
> > > + (alloc_flags & ALLOC_CPUSET) &&
> > > + !__cpuset_zone_allowed(zone, gfp_mask))
> > > + continue;
> > > +
> > > available = reclaimable = zone_reclaimable_pages(zone);
> > > available += zone_page_state_snapshot(zone, NR_FREE_PAGES);
> > >
> >
> > That was my original version, but I found that the problem exists in
> > other places.
> > Please see the function flow below.
> >
> > __alloc_pages_slowpath:
> >
> > get_page_from_freelist
> > __cpuset_zone_allowed /* check the node */
> >
> > __alloc_pages_direct_reclaim
> > shrink_zones
> > cpuset_zone_allowed()/* check the node */
> >
> > __alloc_pages_direct_compact
> > try_to_compact_pages
> > /* do not check the cpuset_zone_allowed()*/
> >
> > should_reclaim_retry
> > /* do not check the cpuset_zone_allowed()*/
> >
> > should_compact_retry
> > compaction_zonelist_suitable
> > /* do not check the cpuset_zone_allowed()*/
> >
> > Should we add __cpuset_zone_allowed() checks in the three functions
> > listed above,
> > or should we set the nodemask in __alloc_pages_slowpath() if it is empty
> > and the request comes from user space?
>
> cpuset integration into the page allocator is rather complex (check
> ALLOC_CPUSET) use. Reviewing your change is not an easy task to make
> sure all the subtlety is preserved. Therefore I would suggest addressing
> the specific issue you have found.
>
Got it,thanks for your suggestion, i will send the next version soon.
> --
> Michal Hocko
> SUSE Labs
prev parent reply other threads:[~2024-08-22 6:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 13:59 Zhongkun He
2024-08-21 15:00 ` Michal Hocko
2024-08-22 3:15 ` [External] " Zhongkun He
2024-08-22 6:24 ` Michal Hocko
2024-08-22 6:39 ` Zhongkun He [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=CACSyD1OjnPU_CLbu9QNkbN41cGFmdwuzT8Kg4340Fk0MuUk+0w@mail.gmail.com \
--to=hezhongkun.hzk@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.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