linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: linux-mm@kvack.org
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
	Matt Mackall <mpm@selenic.com>
Subject: [PATCH 1/2] proc: fix kpage[count,flags] interfaces to account for ARCH_PFN_OFFSET
Date: Fri, 01 Jun 2012 18:54:05 +0200	[thread overview]
Message-ID: <201206011854.05372.b.zolnierkie@samsung.com> (raw)

From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
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@selenic.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 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@kvack.org.  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@kvack.org"> email@kvack.org </a>

                 reply	other threads:[~2012-06-01 16:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201206011854.05372.b.zolnierkie@samsung.com \
    --to=b.zolnierkie@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox