linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yu Zhao <yuzhao@google.com>
To: Johannes Weiner <hannes@cmpxchg.org>,
	 "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: 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: Tue, 14 Jan 2025 20:59:04 -0700	[thread overview]
Message-ID: <CAOUHufaO38q3LFcdXR3HjSC9jK=OtFS=aJxUhetKZZiAF-Cf4g@mail.gmail.com> (raw)
In-Reply-To: <20250113155206.GB829144@cmpxchg.org>

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.)

This approach actually came up during the discussions while I was
looking at the problem. My concern back then was that shifting the
work from the reclaim path to the writeback path can reduce the
overall writeback throughput. IIRC, there were regressions with how I
implemented it. Let me try finding my notes and see if those
regressions still exist with Jen and Kirill's implementation.


  reply	other threads:[~2025-01-15  3:59 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 [this message]
2025-01-17 16:08     ` Johannes Weiner

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='CAOUHufaO38q3LFcdXR3HjSC9jK=OtFS=aJxUhetKZZiAF-Cf4g@mail.gmail.com' \
    --to=yuzhao@google.com \
    --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=hannes@cmpxchg.org \
    --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 \
    /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