Re: Linux regressions report for mainline [2023-02-11]

From: Matthew Wilcox
Date: Sat Feb 11 2023 - 23:30:20 EST


On Sat, Feb 11, 2023 at 01:39:08PM -0800, Linus Torvalds wrote:
> Maybe we should just bite the bullet and say "page cache pages are
> rcu-freed after removing them from the mapping", so that we don't need
> the whole folio_try_get_rcu() at all.

For GUP, you'd also have to do it for any page which has ever been mapped
to userspace, including from drivers. I think that gets a bit tricky.

But there's a good motivation for RCU-freeing page cache pages.
Ben Lahaise once worked on a system which did very small reads which
invariably hit in the page cache. On the order of dozens to hundreds
of bytes. For that workload, cache contention on the page refcount was
the limiting factor on performance. He had an optimisation where he'd
look up the page, memcpy() to a small buffer on the stack, look up the
page again, and if it was the same, copy_to_user(). I was thinking that
we could do that less painfully by RCU-freeing pages.

That's at the back of my mind; I'm kind of busy with other things
right now.