Re: [PATCH v2 2/8] fs/buffer: try to use folio lock for pagecache lookups

Davidlohr Bueso
2025-04-10T17:46:10Z

On Thu, 10 Apr 2025, Jan Kara wrote:

>I'd rather do:
>
> if (atomic) {
> spin_lock(&bd_mapping->i_private_lock);
> folio_locked = false;
> } else {
> folio_lock(folio);
> }
>

Fine with me. I just think the trylock for the atomic scenario would have
given greater chances of successful migration, but at a lack of determinism,
of course.

>I'd actually love to do something like:
>
> if (atomic) {
> if (!folio_trylock(folio))
> bail...
> } else {
> folio_lock(folio);
> }
>
>but that may be just too radical this point and would need some serious
>testing how frequent the trylock failures are. No point in blocking this
>series with it. So just go with the deterministic use of i_private_lock for
>atomic users for now.

This acually crossed my mind, but I also considered the scheme a little
too much for this series.