110 lines
4.0 KiB
Diff
110 lines
4.0 KiB
Diff
|
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||
|
Date: Fri, 17 Jun 2016 18:41:26 +0900
|
||
|
Subject: [PATCH v2] Support _count -> _refcount rename in struct page
|
||
|
Patch-mainline: Released-1-6-1?
|
||
|
Git-commit: 2c21d4656e8d3c2af2b1e14809d076941ae69e96
|
||
|
|
||
|
_count member was renamed to _refcount in linux commit 0139aa7b7fa12
|
||
|
("mm: rename _count, field of the struct page, to _refcount") and this
|
||
|
broke makedumpfile. The reason for making the change was to find all users
|
||
|
accessing it directly and not through the recommended API. I tried
|
||
|
suggesting to revert the change but failed, I see no other choice than to
|
||
|
start supporting both _count and _refcount in makedumpfile.
|
||
|
|
||
|
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||
|
|
||
|
---
|
||
|
makedumpfile.c | 26 +++++++++++++++++++++-----
|
||
|
makedumpfile.h | 3 ++-
|
||
|
2 files changed, 23 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/makedumpfile.c b/makedumpfile.c
|
||
|
index fa0b779ab950..58cce3eb3d76 100644
|
||
|
--- a/makedumpfile.c
|
||
|
+++ b/makedumpfile.c
|
||
|
@@ -1606,7 +1606,14 @@ get_structure_info(void)
|
||
|
*/
|
||
|
SIZE_INIT(page, "page");
|
||
|
OFFSET_INIT(page.flags, "page", "flags");
|
||
|
- OFFSET_INIT(page._count, "page", "_count");
|
||
|
+ OFFSET_INIT(page._refcount, "page", "_refcount");
|
||
|
+ if (OFFSET(page._refcount) == NOT_FOUND_STRUCTURE) {
|
||
|
+ info->flag_use_count = TRUE;
|
||
|
+ OFFSET_INIT(page._refcount, "page", "_count");
|
||
|
+ } else {
|
||
|
+ info->flag_use_count = FALSE;
|
||
|
+ }
|
||
|
+
|
||
|
OFFSET_INIT(page.mapping, "page", "mapping");
|
||
|
OFFSET_INIT(page._mapcount, "page", "_mapcount");
|
||
|
OFFSET_INIT(page.private, "page", "private");
|
||
|
@@ -2048,7 +2055,7 @@ get_mem_type(void)
|
||
|
|
||
|
if ((SIZE(page) == NOT_FOUND_STRUCTURE)
|
||
|
|| (OFFSET(page.flags) == NOT_FOUND_STRUCTURE)
|
||
|
- || (OFFSET(page._count) == NOT_FOUND_STRUCTURE)
|
||
|
+ || (OFFSET(page._refcount) == NOT_FOUND_STRUCTURE)
|
||
|
|| (OFFSET(page.mapping) == NOT_FOUND_STRUCTURE)) {
|
||
|
ret = NOT_FOUND_MEMTYPE;
|
||
|
} else if ((((SYMBOL(node_data) != NOT_FOUND_SYMBOL)
|
||
|
@@ -2155,7 +2162,10 @@ write_vmcoreinfo_data(void)
|
||
|
* write the member offset of 1st kernel
|
||
|
*/
|
||
|
WRITE_MEMBER_OFFSET("page.flags", page.flags);
|
||
|
- WRITE_MEMBER_OFFSET("page._count", page._count);
|
||
|
+ if (info->flag_use_count)
|
||
|
+ WRITE_MEMBER_OFFSET("page._count", page._refcount);
|
||
|
+ else
|
||
|
+ WRITE_MEMBER_OFFSET("page._refcount", page._refcount);
|
||
|
WRITE_MEMBER_OFFSET("page.mapping", page.mapping);
|
||
|
WRITE_MEMBER_OFFSET("page.lru", page.lru);
|
||
|
WRITE_MEMBER_OFFSET("page._mapcount", page._mapcount);
|
||
|
@@ -2490,7 +2500,13 @@ read_vmcoreinfo(void)
|
||
|
|
||
|
|
||
|
READ_MEMBER_OFFSET("page.flags", page.flags);
|
||
|
- READ_MEMBER_OFFSET("page._count", page._count);
|
||
|
+ READ_MEMBER_OFFSET("page._refcount", page._refcount);
|
||
|
+ if (OFFSET(page._refcount) == NOT_FOUND_STRUCTURE) {
|
||
|
+ info->flag_use_count = TRUE;
|
||
|
+ READ_MEMBER_OFFSET("page._count", page._refcount);
|
||
|
+ } else {
|
||
|
+ info->flag_use_count = FALSE;
|
||
|
+ }
|
||
|
READ_MEMBER_OFFSET("page.mapping", page.mapping);
|
||
|
READ_MEMBER_OFFSET("page.lru", page.lru);
|
||
|
READ_MEMBER_OFFSET("page._mapcount", page._mapcount);
|
||
|
@@ -5549,7 +5565,7 @@ __exclude_unnecessary_pages(unsigned long mem_map,
|
||
|
pcache = page_cache + (index_pg * SIZE(page));
|
||
|
|
||
|
flags = ULONG(pcache + OFFSET(page.flags));
|
||
|
- _count = UINT(pcache + OFFSET(page._count));
|
||
|
+ _count = UINT(pcache + OFFSET(page._refcount));
|
||
|
mapping = ULONG(pcache + OFFSET(page.mapping));
|
||
|
|
||
|
if ((index_pg < PGMM_CACHED - 1) &&
|
||
|
diff --git a/makedumpfile.h b/makedumpfile.h
|
||
|
index e0b5bbf3dfc5..bc0d4218fe2a 100644
|
||
|
--- a/makedumpfile.h
|
||
|
+++ b/makedumpfile.h
|
||
|
@@ -1097,6 +1097,7 @@ struct DumpInfo {
|
||
|
int flag_use_printk_log; /* did we read printk_log symbol name? */
|
||
|
int flag_nospace; /* the flag of "No space on device" error */
|
||
|
int flag_vmemmap; /* kernel supports vmemmap address space */
|
||
|
+ int flag_use_count; /* _refcount is named _count in struct page */
|
||
|
unsigned long vaddr_for_vtop; /* virtual address for debugging */
|
||
|
long page_size; /* size of page */
|
||
|
long page_shift;
|
||
|
@@ -1479,7 +1480,7 @@ struct size_table {
|
||
|
struct offset_table {
|
||
|
struct page {
|
||
|
long flags;
|
||
|
- long _count;
|
||
|
+ long _refcount;
|
||
|
long mapping;
|
||
|
long lru;
|
||
|
long _mapcount;
|
||
|
--
|
||
|
2.9.0
|
||
|
|