From: Andrew Morton <akpm@linux-foundation.org>
To: Chris Goldsworthy <cgoldswo@codeaurora.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Laura Abbott <lauraa@codeaurora.org>
Subject: Re: [PATCH v3] fs/buffer.c: Revoke LRU when trying to drop buffers
Date: Mon, 15 Mar 2021 16:41:38 -0700 [thread overview]
Message-ID: <20210315164138.c15727adeb184313f5e7e9f6@linux-foundation.org> (raw)
In-Reply-To: <2f13c006ad12b047e9e4d5de008e5d5c41322754.1610572007.git.cgoldswo@codeaurora.org>
On Wed, 13 Jan 2021 13:17:30 -0800 Chris Goldsworthy <cgoldswo@codeaurora.org> wrote:
> From: Laura Abbott <lauraa@codeaurora.org>
>
> When a buffer is added to the LRU list, a reference is taken which is
> not dropped until the buffer is evicted from the LRU list. This is the
> correct behavior, however this LRU reference will prevent the buffer
> from being dropped. This means that the buffer can't actually be dropped
> until it is selected for eviction. There's no bound on the time spent
> on the LRU list, which means that the buffer may be undroppable for
> very long periods of time. Given that migration involves dropping
> buffers, the associated page is now unmigratible for long periods of
> time as well. CMA relies on being able to migrate a specific range
> of pages, so these types of failures make CMA significantly
> less reliable, especially under high filesystem usage.
>
> Rather than waiting for the LRU algorithm to eventually kick out
> the buffer, explicitly remove the buffer from the LRU list when trying
> to drop it. There is still the possibility that the buffer
> could be added back on the list, but that indicates the buffer is
> still in use and would probably have other 'in use' indicates to
> prevent dropping.
>
> Note: a bug reported by "kernel test robot" lead to a switch from
> using xas_for_each() to xa_for_each().
(hm, why isn't drop_buffers() static to fs/buffer.c??)
It looks like patch this turns drop_buffers() into a very expensive
operation. And that expensive operation occurs under the
address_space-wide private_lock, which is more ouch.
How carefully has this been tested for performance? In pathological
circumstances (which are always someone's common case :()
Just thinking out loud...
If a buffer_head* is sitting in one or more of the LRUs, what is
stopping us from stripping it from the page anyway? Then
try_to_free_buffers() can mark the bh as buffer_dead(), declare success
and leave the bh sitting in the LRU, with the LRU as the only reference
to that buffer. Teach lookup_bh_lru() to skip over buffer_dead()
buffers and our now-dead buffer will eventually reach the tail of the
lru and get freed for real.
next prev parent reply other threads:[~2021-03-15 23:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 21:17 [PATCH v3] Resolve LRU page-pinning issue for file-backed pages Chris Goldsworthy
2021-01-13 21:17 ` [PATCH v3] fs/buffer.c: Revoke LRU when trying to drop buffers Chris Goldsworthy
2021-03-15 23:41 ` Andrew Morton [this message]
2021-03-15 23:46 ` Matthew Wilcox
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=20210315164138.c15727adeb184313f5e7e9f6@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cgoldswo@codeaurora.org \
--cc=lauraa@codeaurora.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).