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

From: Matthew Wilcox
Date: Mon Jul 08 2024 - 18:37:00 EST


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().

> @@ -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.