From: Christoph Hellwig <hch@lst.de>
To: Brian Foster <bfoster@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>, Carlos Maiolino <cem@kernel.org>,
Dave Chinner <dchinner@redhat.com>,
linux-xfs@vger.kernel.org, "Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [PATCH 1/3] xfs: don't keep a reference for buffers on the LRU
Date: Tue, 27 Jan 2026 06:20:50 +0100 [thread overview]
Message-ID: <20260127052050.GB24364@lst.de> (raw)
In-Reply-To: <aXe-EkVrEB-UhNy2@bfoster>
On Mon, Jan 26, 2026 at 02:18:42PM -0500, Brian Foster wrote:
> > + /*
> > + * If the buffer is in use, remove it from the LRU for now as we can't
> > + * free it. It will be added to the LRU again when the reference count
> > + * hits zero.
> > + */
> > + if (bp->b_hold > 0) {
> > + list_lru_isolate(lru, &bp->b_lru);
> > + spin_unlock(&bp->b_lock);
> > + return LRU_REMOVED;
> > + }
> > +
>
> Sorry I missed this on my first look at this, but I don't think I quite
> realized why this was here. This looks like a subtle change in behavior
> where a buffer that makes it onto the LRU and then is subsequently held
> can no longer be cycled off the LRU by background shrinker activity.
> Instead, we drop the buffer off the LRU entirely where it will no longer
> be visible from ongoing shrinker activity.
Yes.
> AFAICT the reason for this is we no longer support the ability for the
> shrinker to drop the LRU b_hold ref to indicate a buffer is fully cycled
> out and can go direct to freeing when the current b_hold lifecycle ends.
> Am I following that correctly?
Yes.
> If so, that doesn't necessarily seem like a showstopper as I'm not sure
> realistically a significant amount of memory would be caught up like
> this in practice, even under significant pressure. But regardless, why
> not do this preventative LRU removal only after the lru ref count is
> fully depleted? Wouldn't that more accurately preserve existing
> behavior, or am I missing something?
It would more closely resemble the current behavior, which seems wrong
and an artifact of the current reference counting. A buffer that is
in use really should not be counted down on the LRU, which really is
for unused buffers. So starting the countdown only once the buffer
is unused is the right thing to do. I should have explained this
much better, though.
next prev parent reply other threads:[~2026-01-27 5:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 5:37 buffer cache simplification v3 Christoph Hellwig
2026-01-26 5:38 ` [PATCH 1/3] xfs: don't keep a reference for buffers on the LRU Christoph Hellwig
2026-01-26 19:18 ` Brian Foster
2026-01-27 5:20 ` Christoph Hellwig [this message]
2026-01-27 15:42 ` Brian Foster
2026-01-27 16:42 ` Christoph Hellwig
2026-01-26 5:38 ` [PATCH 2/3] xfs: use a lockref for the buffer reference count Christoph Hellwig
2026-01-26 5:38 ` [PATCH 3/3] xfs: switch (back) to a per-buftarg buffer hash Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2026-01-22 5:26 buffer cache simplification v2 Christoph Hellwig
2026-01-22 5:26 ` [PATCH 1/3] xfs: don't keep a reference for buffers on the LRU Christoph Hellwig
2026-01-23 11:55 ` Carlos Maiolino
2026-01-23 16:01 ` Brian Foster
2026-01-19 15:31 buffer cache simplification Christoph Hellwig
2026-01-19 15:31 ` [PATCH 1/3] xfs: don't keep a reference for buffers on the LRU Christoph Hellwig
2026-01-20 2:53 ` Darrick J. Wong
2026-01-20 6:55 ` Christoph Hellwig
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=20260127052050.GB24364@lst.de \
--to=hch@lst.de \
--cc=bfoster@redhat.com \
--cc=cem@kernel.org \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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