lkml.org 
[lkml]   [2009]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 4/5] proc: kpagecount/kpageflags code cleanup
Move increments of pfn/out to bottom of the loop.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
fs/proc/page.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

--- mm.orig/fs/proc/page.c
+++ mm/fs/proc/page.c
@@ -32,20 +32,22 @@ static ssize_t kpagecount_read(struct fi
return -EINVAL;

while (count > 0) {
- ppage = NULL;
if (pfn_valid(pfn))
ppage = pfn_to_page(pfn);
- pfn++;
+ else
+ ppage = NULL;
if (!ppage)
pcount = 0;
else
pcount = page_mapcount(ppage);

- if (put_user(pcount, out++)) {
+ if (put_user(pcount, out)) {
ret = -EFAULT;
break;
}

+ pfn++;
+ out++;
count -= KPMSIZE;
}

@@ -98,10 +100,10 @@ static ssize_t kpageflags_read(struct fi
return -EINVAL;

while (count > 0) {
- ppage = NULL;
if (pfn_valid(pfn))
ppage = pfn_to_page(pfn);
- pfn++;
+ else
+ ppage = NULL;
if (!ppage)
kflags = 0;
else
@@ -119,11 +121,13 @@ static ssize_t kpageflags_read(struct fi
kpf_copy_bit(kflags, KPF_RECLAIM, PG_reclaim) |
kpf_copy_bit(kflags, KPF_BUDDY, PG_buddy);

- if (put_user(uflags, out++)) {
+ if (put_user(uflags, out)) {
ret = -EFAULT;
break;
}

+ pfn++;
+ out++;
count -= KPMSIZE;
}

--



\
 
 \ /
  Last update: 2009-04-28 03:55    [W:0.653 / U:0.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site