From: Johannes Weiner <hannes@cmpxchg.org>
To: Yu Zhao <yuzhao@google.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Chen Ridong <chenridong@huaweicloud.com>,
akpm@linux-foundation.org, mhocko@suse.com,
yosryahmed@google.com, david@redhat.com, willy@infradead.org,
ryan.roberts@arm.com, baohua@kernel.org, 21cnbao@gmail.com,
wangkefeng.wang@huawei.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, chenridong@huawei.com,
wangweiyang2@huawei.com, xieym_ict@hotmail.com
Subject: Re: [PATCH v7 mm-unstable] mm: vmscan: retry folios written back while isolated for traditional LRU
Date: Fri, 17 Jan 2025 11:08:04 -0500 [thread overview]
Message-ID: <20250117160804.GA182896@cmpxchg.org> (raw)
In-Reply-To: <CAOUHufaO38q3LFcdXR3HjSC9jK=OtFS=aJxUhetKZZiAF-Cf4g@mail.gmail.com>
On Tue, Jan 14, 2025 at 08:59:04PM -0700, Yu Zhao wrote:
> On Mon, Jan 13, 2025 at 8:52 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
> >
> > On Sat, Jan 11, 2025 at 09:15:04AM +0000, Chen Ridong wrote:
> > > @@ -5706,6 +5706,44 @@ static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control *
> > >
> > > #endif /* CONFIG_LRU_GEN */
> > >
> > > +/**
> > > + * find_folios_written_back - Find and move the written back folios to a new list.
> > > + * @list: filios list
> > > + * @clean: the written back folios list
> > > + * @lruvec: the lruvec
> > > + * @type: LRU_GEN_ANON/LRU_GEN_FILE, only for multi-gen LRU
> > > + * @skip_retry: whether skip retry.
> > > + */
> > > +static inline void find_folios_written_back(struct list_head *list,
> > > + struct list_head *clean, struct lruvec *lruvec, int type, bool skip_retry)
> > > +{
> > > + struct folio *folio;
> > > + struct folio *next;
> > > +
> > > + list_for_each_entry_safe_reverse(folio, next, list, lru) {
> > > +#ifdef CONFIG_LRU_GEN
> > > + DEFINE_MIN_SEQ(lruvec);
> > > +#endif
> > > + if (!folio_evictable(folio)) {
> > > + list_del(&folio->lru);
> > > + folio_putback_lru(folio);
> > > + continue;
> > > + }
> > > +
> > > + /* retry folios that may have missed folio_rotate_reclaimable() */
> > > + if (!skip_retry && !folio_test_active(folio) && !folio_mapped(folio) &&
> > > + !folio_test_dirty(folio) && !folio_test_writeback(folio)) {
> > > + list_move(&folio->lru, clean);
> > > + continue;
> > > + }
> > > +#ifdef CONFIG_LRU_GEN
> > > + /* don't add rejected folios to the oldest generation */
> > > + if (lru_gen_enabled() && lru_gen_folio_seq(lruvec, folio, false) == min_seq[type])
> > > + set_mask_bits(&folio->flags, LRU_REFS_FLAGS, BIT(PG_active));
> > > +#endif
> > > + }
> >
> > Can't this solved much more easily by acting on the flag in the
> > generic LRU add/putback path? Instead of walking the list again.
> >
> > Especially with Kirill's "[PATCH 0/8] mm: Remove PG_reclaim" that
> > removes the PG_readahead ambiguity.
>
> I don't follow -- my understanding is that with Kirill's series, there
> is no need to do anything for the generic path. (I'll remove the retry
> in MGLRU which Kirill left behind.)
Dropbehind trylocks the folio, so there is still a chance of misses
when the IO submission is from reclaim (which also relocks the folio
after IO submission).
Granted, that race window is much smaller compared to the window
between rotation and batched LRU putback. Probably best to retest on
top of all the pending patches.
prev parent reply other threads:[~2025-01-17 16:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 9:15 Chen Ridong
2025-01-11 22:12 ` Yu Zhao
2025-01-13 8:35 ` chenridong
2025-01-13 15:52 ` Johannes Weiner
2025-01-15 3:59 ` Yu Zhao
2025-01-17 16:08 ` Johannes Weiner [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=20250117160804.GA182896@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=chenridong@huawei.com \
--cc=chenridong@huaweicloud.com \
--cc=david@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=ryan.roberts@arm.com \
--cc=wangkefeng.wang@huawei.com \
--cc=wangweiyang2@huawei.com \
--cc=willy@infradead.org \
--cc=xieym_ict@hotmail.com \
--cc=yosryahmed@google.com \
--cc=yuzhao@google.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