[PATCH v2 08/10] Add page_is_buddy for PG_buddy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On kernels from v2.6.18 to v2.6.37, buddy page is marked by the
PG_buddy flag.

  kernel version     | PG_buddy
  ------------------ +---------------------------------
  v2.6.17 to v2.6.26 | 19
  v2.6.27 to v2.6.37 | 19 if CONFIG_PAGEFLAGS_EXTEND=y
                     | 18 otherwise

We don't need to care about CONFIG_PAGEFLAGS_EXTEND because the
architectures specifying this as y are um and xtensa only. They are
not included in the supported architectures of makedumpfile.

Signed-off-by: HATAYAMA Daisuke <d.hatayama at jp.fujitsu.com>
---

 makedumpfile.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 7b13dca..4e5d4d3 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3669,6 +3669,19 @@ exclude_free_page(void)
 }
 
 /*
+ * For the kernel versions from v2.6.17 to v2.6.37.
+ */
+static int
+page_is_buddy_v2(unsigned long flags, unsigned int _mapcount,
+			unsigned long private, unsigned int _count)
+{
+	if (flags & (1UL << NUMBER(PG_buddy)))
+		return TRUE;
+
+	return FALSE;
+}
+
+/*
  * For v2.6.38 and later kernel versions.
  */
 static int
@@ -3690,10 +3703,13 @@ setup_page_is_buddy(void)
 	if (OFFSET(page.private) == NOT_FOUND_STRUCTURE)
 		goto out;
 
-	if (NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE) != NOT_FOUND_NUMBER) {
-		if (OFFSET(page._mapcount) != NOT_FOUND_STRUCTURE)
-			info->page_is_buddy = page_is_buddy_v3;
-	}
+	if (NUMBER(PG_buddy) == NOT_FOUND_NUMBER) {
+		if (NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE) != NOT_FOUND_NUMBER) {
+			if (OFFSET(page._mapcount) != NOT_FOUND_STRUCTURE)
+				info->page_is_buddy = page_is_buddy_v3;
+		}
+	} else
+		info->page_is_buddy = page_is_buddy_v2;
 
 out:
 	if (!info->page_is_buddy)




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux