The patch titled Subject: mm/truncate: bail out early from invalidate_inode_pages2_range() if mapping is empty has been added to the -mm tree. Its filename is mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Subject: mm/truncate: bail out early from invalidate_inode_pages2_range() if mapping is empty If mapping is empty (both ->nrpages and ->nrexceptional is zero) we can avoid pointless lookups in empty radix tree and bail out immediately after cleancache invalidation. Link: http://lkml.kernel.org/r/20170424164135.22350-4-aryabinin@xxxxxxxxxxxxx Signed-off-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Reviewed-by: Jan Kara <jack@xxxxxxx> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx Cc: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Alexey Kuznetsov <kuznet@xxxxxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Nikolay Borisov <n.borisov.lkml@xxxxxxxxx Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/truncate.c | 3 +++ 1 file changed, 3 insertions(+) diff -puN mm/truncate.c~mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty mm/truncate.c --- a/mm/truncate.c~mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty +++ a/mm/truncate.c @@ -624,6 +624,9 @@ int invalidate_inode_pages2_range(struct int did_range_unmap = 0; cleancache_invalidate_inode(mapping); + if (mapping->nrpages == 0 && mapping->nrexceptional == 0) + return 0; + pagevec_init(&pvec, 0); index = start; while (index <= end && pagevec_lookup_entries(&pvec, mapping, index, _ Patches currently in -mm which might be from aryabinin@xxxxxxxxxxxxx are fs-fix-data-invalidation-in-the-cleancache-during-direct-io.patch fs-block_dev-always-invalidate-cleancache-in-invalidate_bdev.patch mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty.patch mm-truncate-avoid-pointless-cleancache_invalidate_inode-calls.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html