[Devel] [PATCH RHEL7 COMMIT] cleancache: avoid pointless cleancache_invalidate_inode() calls.

Konstantin Khorenko khorenko at virtuozzo.com
Thu Apr 13 03:41:05 PDT 2017


The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.15
------>
commit 456aa581f3cd05b156995b2b03a498133733b25f
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Thu Apr 13 14:41:05 2017 +0400

    cleancache: avoid pointless cleancache_invalidate_inode() calls.
    
    Per Alexey: there is no point in invalidation of cleancache on entry to
    truncate_inode_pages_range/invalidate_inode_pages2_range routines.
    It is waste of time, cleancache will be repopulated by invalidation
    (which it stupid, of course). It is enough to do this once at exit.
    
    https://jira.sw.ru/browse/PSBM-63908
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/truncate.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/mm/truncate.c b/mm/truncate.c
index ce4b1d8..1db0425 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -285,9 +285,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
 	int		i;
 	int		bug_if_page_has_bh = 0;
 
-	cleancache_invalidate_inode(mapping);
 	if (mapping->nrpages == 0 && mapping->nrexceptional == 0)
-		return;
+		goto out;
 
 	/* Offsets within partial pages */
 	partial_start = lstart & (PAGE_CACHE_SIZE - 1);
@@ -390,7 +389,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
 	 * will be released, just zeroed, so we can bail out now.
 	 */
 	if (start >= end)
-		return;
+		goto out;
 
 	index = start;
 	for ( ; ; ) {
@@ -431,6 +430,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
 		pagevec_release(&pvec);
 		index++;
 	}
+
+out:
 	cleancache_invalidate_inode(mapping);
 }
 EXPORT_SYMBOL(truncate_inode_pages_range);
@@ -627,10 +628,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
 	int ret2 = 0;
 	int did_range_unmap = 0;
 
-	cleancache_invalidate_inode(mapping);
-
 	if (mapping->nrpages == 0 && mapping->nrexceptional == 0)
-		return 0;
+		goto out;
 
 	pagevec_init(&pvec, 0);
 	index = start;
@@ -692,6 +691,8 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
 		cond_resched();
 		index++;
 	}
+
+out:
 	cleancache_invalidate_inode(mapping);
 	return ret;
 }


More information about the Devel mailing list