Re: [PATCH mm-unstable v1] mm/truncate: batch-clear shadow entries

From: Yu Zhao
Date: Tue Jul 09 2024 - 18:30:55 EST


On Mon, Jul 8, 2024 at 4:36 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Mon, Jul 08, 2024 at 03:27:53PM -0600, Yu Zhao wrote:
> > Make clear_shadow_entry() clear shadow entries in `struct folio_batch`
> > so that it can reduce contention on i_lock and i_pages locks, e.g.,
>
> I think it needs to be renamed, perhaps to clear_shadow_entries().

Yes, thank you.

> > @@ -503,8 +486,8 @@ unsigned long mapping_try_invalidate(struct address_space *mapping,
> > /* We rely upon deletion not changing folio->index */
> >
> > if (xa_is_value(folio)) {
> > - count += invalidate_exceptional_entry(mapping,
> > - indices[i], folio);
> > + xa_has_values = true;
> > + count++;
>
> Mmm. This is awkward. It's supposed to return the number of pages,
> not the number of folios (or shadow entries) invalidated.

I didn't think about this much. It seems to me no callers really care
about it other than some debugging messages?