]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/truncate: reset xa_has_values flag on each iteration
authorShakeel Butt <shakeel.butt@linux.dev>
Wed, 2 Oct 2024 22:51:50 +0000 (15:51 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:28:57 +0000 (21:28 -0700)
commit234b9b50d83015121710d3ce675ef59ea9e82929
tree32f4c4e545cccb757c5293e6765f27e65266a7f2
parent41aa3d7e5ef318078575fdbd56a5ec707ea04491
mm/truncate: reset xa_has_values flag on each iteration

Currently mapping_try_invalidate() and invalidate_inode_pages2_range()
traverses the xarray in batches and then for each batch, maintains and
sets the flag named xa_has_values if the batch has a shadow entry to clear
the entries at the end of the iteration.

However they forgot to reset the flag at the end of the iteration which
causes them to always try to clear the shadow entries in the subsequent
iterations where there might not be any shadow entries.

Fix this inefficiency.

Link: https://lkml.kernel.org/r/20241002225150.2334504-1-shakeel.butt@linux.dev
Fixes: 61c663e020d2 ("mm/truncate: batch-clear shadow entries")
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Yu Zhao <yuzhao@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/truncate.c