mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
proc: kpagecount/kpageflags code cleanup
Move increments of pfn/out to bottom of the loop. Signed-off-by: Wu Fengguang <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: Andi Kleen <[email protected]> Acked-by: Matt Mackall <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Ingo Molnar <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
20a0307c03
commit
ed7ce0f102
1 changed files with 11 additions and 6 deletions
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#define KPMSIZE sizeof(u64)
|
||||
#define KPMMASK (KPMSIZE - 1)
|
||||
|
||||
/* /proc/kpagecount - an array exposing page counts
|
||||
*
|
||||
* Each entry is a u64 representing the corresponding
|
||||
|
|
@ -33,20 +34,22 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -99,10 +102,10 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
|
|||
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
|
||||
|
|
@ -120,11 +123,13 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue