Skip to content

mm: Speedup page cache truncation

Jan Kara linux-fsdevel lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest23 patches 0 repliesNew
  2. v18 patches 23 repliesSuperseded

Changes in v2 from the cover letter

- rebased on 5.7-rc2
- drop xas_for_each_marked() fix as it was already merged
- reworked the whole series based on Matthew's feedback - we now create new function xas_store_noinit() and use it instead of changing xas_store() behavior. Note that for xas_store_range() and __xa_cmpxchg() I didn't bother to change names although they stop clearing marks as well. This is because there are only very few callers so it's easy to verify them, also chances of a clash with other patch introducing new callers are very small.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23xarray: Remove stale commentlib/xarray.c+0 -70 replies
2/23xarray: Provide xas_erase() and xas_store_noinit() helpersinclude/linux/xarray.h lib/xarray.c+46 -150 replies
3/23xarray: Use xas_store_noinit() in __xa_store, __xa_insert, __xa_alloclib/xarray.c+5 -50 replies
4/23xarray: Switch xa_store_range() to use xas_store_noinit()lib/xarray.c+1 -10 replies
5/23xarray: Use xas_erase() in __xa_erase()lib/xarray.c+1 -10 replies
6/23xarray: Explicitely set XA_FREE_MARK in __xa_cmpxchg()lib/xarray.c+6 -20 replies
7/23xarray: Switch __xa_cmpxchg() to use xas_store_noinit()lib/xarray.c+3 -20 replies
8/23dax: Use xas_erase() in __dax_invalidate_entry()fs/dax.c+1 -10 replies
9/23dax: Use dax_store_noinit() in grab_mapping_entry()fs/dax.c+5 -10 replies
10/23dax: Convert xas_store() to xas_store_noinit()fs/dax.c+3 -30 replies
11/23mm: Use xas_erase() in page_cache_delete_batch()mm/filemap.c+1 -10 replies
12/23mm: Use xas_erase() in collapse_file()mm/khugepaged.c+1 -10 replies
13/23mm: Use xas_store_noinit() when storing non-NULLmm/filemap.c mm/khugepaged.c mm/migrate.c +2 more+12 -120 replies
14/23workingset: Use xas_store_noinit() to clear shadow entrymm/truncate.c mm/workingset.c+2 -20 replies
15/23swap: Use xas_erase() when removing page from swap cachemm/swap_state.c+1 -10 replies
16/23idr: Use xas_erase() in ida_destroy()lib/idr.c+1 -10 replies
17/23idr: Use xas_erase() in ida_free()lib/idr.c+1 -10 replies
18/23idr: Convert xas_store() to xas_store_noinit()lib/idr.c+4 -40 replies
19/23testing: Use xas_erase() to remove entries from xarraylib/test_xarray.c tools/testing/radix-tree/test.c+6 -60 replies
20/23testing: Use xas_store_noinit() for non-NULL entrieslib/test_xarray.c tools/testing/radix-tree/iteration_check.c tools/testing/radix-tree/multiorder.c+16 -160 replies
21/23testing: Introduce xa_erase_order() and use itlib/test_xarray.c+12 -20 replies
22/23testing: Switch xa_store_order() to xas_store_noinit()lib/test_xarray.c+1 -10 replies
23/23xarray: Remove xas_store()Documentation/core-api/xarray.rst include/linux/xarray.h lib/xarray.c+6 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH 0/23 v2] mm: Speedup page cache truncation

Hello,

this is a second version of my patches to avoid clearing marks from xas_store() and thus fix regression in page cache truncation.

Changes since v1
- rebased on 5.7-rc2
- drop xas_for_each_marked() fix as it was already merged
- reworked the whole series based on Matthew's feedback - we now create new function xas_store_noinit() and use it instead of changing xas_store() behavior. Note that for xas_store_range() and __xa_cmpxchg() I didn't bother to change names although they stop clearing marks as well. This is because there are only very few callers so it's easy to verify them, also chances of a clash with other patch introducing new callers are very small.

Original motivation:

Conversion of page cache to xarray (commit 69b6c1319b6 "mm: Convert truncate to XArray" in particular) has regressed performance of page cache truncation by about 10% (see my original report here [1]). This patch series aims at improving the truncation to get some of that regression back.

The first patch fixes a long standing bug with xas_for_each_marked() that I've uncovered when debugging my patches. The remaining patches then work towards the ability to stop clearing marks in xas_store() which improves truncation performance by about 6%.

The patches have passed radix_tree tests in tools/testing and also fstests runs for ext4 & xfs.

Honza

[1] https://lore.kernel.org/linux-mm/[email protected]