[PATCH 1/2] proc: fix kpage[count,flags] interfaces to account for ARCH_PFN_OFFSET

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

 



From: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
Subject: [PATCH] proc: fix kpage[count,flags] interfaces to account for ARCH_PFN_OFFSET

ARCH_PFN_OFFSET gives us the first PFN number (i.e. on ARM Exynos4
platform it is equal to 262144) while max_pfn is only the total
number of PFNs (i.e. on ARM Exynos4 Universal C210 board it is equal
to 131072) so currently it is impossible to read page count/flags
values on affected archs/platforms throught /proc/kpage[count,flags]
interfaces.  Fix it by making code aware of ARCH_PFN_OFFSET.

[ For x86 the resulting code remains unchanged as ARCH_PFN_OFFSET
  is eual to 0. ]

Cc: Matt Mackall <mpm@xxxxxxxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 fs/proc/page.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: b/fs/proc/page.c
===================================================================
--- a/fs/proc/page.c	2012-05-31 15:45:27.887110216 +0200
+++ b/fs/proc/page.c	2012-05-31 16:33:37.455109659 +0200
@@ -31,7 +31,8 @@ static ssize_t kpagecount_read(struct fi
 	u64 pcount;
 
 	pfn = src / KPMSIZE;
-	count = min_t(size_t, count, (max_pfn * KPMSIZE) - src);
+	count = min_t(size_t, count,
+		      ((ARCH_PFN_OFFSET + max_pfn) * KPMSIZE) - src);
 	if (src & KPMMASK || count & KPMMASK)
 		return -EINVAL;
 
@@ -174,7 +175,8 @@ static ssize_t kpageflags_read(struct fi
 	ssize_t ret = 0;
 
 	pfn = src / KPMSIZE;
-	count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src);
+	count = min_t(unsigned long, count,
+		      ((ARCH_PFN_OFFSET + max_pfn) * KPMSIZE) - src);
 	if (src & KPMMASK || count & KPMMASK)
 		return -EINVAL;
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]