makedumpfile/makedumpfile-is_cache_page-helper.patch
Petr Tesařík 922cea35f8 Accepting request 602491 from home:ptesarik:branches:Kernel:kdump
- makedumpfile-is_cache_page-helper.patch: Add is_cache_page()
  helper to check if a page belongs to the cache (bsc#1088354).
- makedumpfile-check-PG_swapbacked.patch: Check PG_swapbacked for
  swap cache pages (bsc#1088354).

OBS-URL: https://build.opensuse.org/request/show/602491
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/makedumpfile?expand=0&rev=123
2018-04-30 10:52:59 +00:00

48 lines
1.4 KiB
Diff

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;