This is another revision of the radix tree / workingset patches based on feedback from Jan and Kirill. Thanks for your input.
This is a follow-up to d3798ae8c6f3 ("mm: filemap: don't plant shadow entries without radix tree node"). That patch fixed an issue that was caused mainly by the page cache sneaking special shadow page entries into the radix tree and relying on subtleties in the radix tree code to make that work. The fix also had to stop tracking refaults for single-page files because shadow pages stored as direct pointers in radix_tree_root->rnode weren't properly handled during tree extension. These patches make the radix tree code explicitely support and track such special entries, to eliminate the subtleties and to restore the thrash detection for single-page files. Changes since v2: - Shadow entry accounting and radix tree node tracking are fully gone from the page cache code, making it much simpler and robust. Counts are kept natively in the radix tree, node tracking is done from one simple callback function in the workingset code. Thanks Jan. - One more radix tree fix in khugepaged's new shmem collapsing code. Thanks Kirill and Jan. arch/s390/mm/gmap.c | 2 +- drivers/sh/intc/virq.c | 2 +- fs/dax.c | 10 +- include/linux/radix-tree.h | 34 ++-- include/linux/swap.h | 34 +--- lib/radix-tree.c | 297 ++++++++++++++++++++------------ mm/filemap.c | 63 +------ mm/khugepaged.c | 16 +- mm/migrate.c | 4 +- mm/shmem.c | 9 +- mm/truncate.c | 21 +-- mm/workingset.c | 70 ++++++-- tools/testing/radix-tree/multiorder.c | 2 +- 13 files changed, 292 insertions(+), 272 deletions(-)