File makedumpfile-is_cache_page-helper.patch of Package makedumpfile.14460

From: Petr Tesarik <ptesarik@suse.com>
Date: Fri, 13 Apr 2018 15:58:45 +0200
Subject: Add is_cache_page() helper to check if a page belongs to the cache
References: bsc#1088354
Upstream: posted 2018-04-13

No functional change, but clarify the purpose of checking isLRU()
and SwapCache(), and move the check to a single place.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 makedumpfile.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -249,6 +249,12 @@ isHugetlb(int dtor)
                     && (SYMBOL(free_huge_page) == dtor));
 }
 
+static int
+is_cache_page(unsigned long flags)
+{
+	return isLRU(flags) || isSwapCache(flags);
+}
+
 static inline unsigned long
 calculate_len_buf_out(long page_size)
 {
@@ -5850,7 +5856,7 @@ __exclude_unnecessary_pages(unsigned lon
 		 * Exclude the non-private cache page.
 		 */
 		else if ((info->dump_level & DL_EXCLUDE_CACHE)
-		    && (isLRU(flags) || isSwapCache(flags))
+		    && is_cache_page(flags)
 		    && !isPrivate(flags) && !isAnon(mapping)) {
 			pfn_counter = &pfn_cache;
 		}
@@ -5858,7 +5864,7 @@ __exclude_unnecessary_pages(unsigned lon
 		 * Exclude the cache page whether private or non-private.
 		 */
 		else if ((info->dump_level & DL_EXCLUDE_CACHE_PRI)
-		    && (isLRU(flags) || isSwapCache(flags))
+		    && is_cache_page(flags)
 		    && !isAnon(mapping)) {
 			if (isPrivate(flags))
 				pfn_counter = &pfn_cache_private;
openSUSE Build Service is sponsored by