From: Zhaoyang Huang <huangzhaoyang@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
ke.wang@unisoc.com
Subject: Re: [PATCHv4] mm: skip CMA pages when they are not available
Date: Fri, 26 May 2023 10:30:20 +0800 [thread overview]
Message-ID: <CAGWkznGz6w-56wye-0XG=bZMPLY21g33mcAHuWqYvpaHQJUJEw@mail.gmail.com> (raw)
In-Reply-To: <ZG+/EW9NzGsAcGfF@casper.infradead.org>
On Fri, May 26, 2023 at 4:03 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Mon, May 22, 2023 at 02:36:03PM +0800, zhaoyang.huang wrote:
> > +#ifdef CONFIG_CMA
> > +/*
> > + * It is waste of effort to scan and reclaim CMA pages if it is not available
> > + * for current allocation context
> > + */
> > +static bool skip_cma(struct folio *folio, struct scan_control *sc)
> > +{
> > + if (!current_is_kswapd() &&
> > + gfp_migratetype(sc->gfp_mask) != MIGRATE_MOVABLE &&
> > + get_pageblock_migratetype(&folio->page) == MIGRATE_CMA)
> > + return true;
> > + return false;
> > +}
> > +#else
> > +static bool skip_cma(struct folio *folio, struct scan_control *sc)
> > +{
> > + return false;
> > +}
> > +#endif
> > +
> > /*
> > * Isolating page from the lruvec to fill in @dst list by nr_to_scan times.
> > *
> > @@ -2239,7 +2259,8 @@ static unsigned long isolate_lru_folios(unsigned long nr_to_scan,
> > nr_pages = folio_nr_pages(folio);
> > total_scan += nr_pages;
> >
> > - if (folio_zonenum(folio) > sc->reclaim_idx) {
> > + if (folio_zonenum(folio) > sc->reclaim_idx ||
> > + skip_cma(folio, sc)) {
> > nr_skipped[folio_zonenum(folio)] += nr_pages;
> > move_to = &folios_skipped;
> > goto move;
>
> I have no idea if what this patch is trying to accomplish is correct,
> but I no longer object to how it is doing it.
IMO, this is necessary as there could be such weird scenario, that is
an GFP_KERNEL allocation might get 32 MIGRATE_CMA pages via
direct_reclaim which lead to a low PSI_MEM/vmpressure value but return
a NULL pointer
next prev parent reply other threads:[~2023-05-26 2:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 6:36 zhaoyang.huang
2023-05-25 20:03 ` Matthew Wilcox
2023-05-26 2:30 ` Zhaoyang Huang [this message]
2023-05-26 19:36 ` David Hildenbrand
2023-05-29 1:02 ` Zhaoyang Huang
2023-05-26 23:03 ` Minchan Kim
2023-05-29 1:11 ` Zhaoyang Huang
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='CAGWkznGz6w-56wye-0XG=bZMPLY21g33mcAHuWqYvpaHQJUJEw@mail.gmail.com' \
--to=huangzhaoyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=willy@infradead.org \
--cc=zhaoyang.huang@unisoc.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