[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100114085230.GA12078@localhost>
Date: Thu, 14 Jan 2010 16:52:30 +0800
From: Wu Fengguang <fengguang.wu@...el.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Matt Mackall <mpm@...enic.com>,
LKML <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rjw@...k.pl>
Subject: [PATCH] pagemap: early return on unmapped areas
On Thu, Jan 14, 2010 at 04:30:48PM +0800, Andi Kleen wrote:
> > ---
> > pagemap: early return on unmapped areas
>
> Yes seems like a reasonable idea.
Thanks!
I just changed the ">" to ">=", because it happen to make a difference
for cp/cat, which does 4k sized read:
4k read buffer = 4k/8 pages = 512 pages = NR_PMD_PAGES
So the change to ">=" makes cp exit immediately (4k buffer matches
exactly one PMD hole).
before
dd if=/proc/$$/pagemap of=/dev/null bs=4k
512+0 records in
512+0 records out
2097152 bytes (2.1 MB) copied, 0.0225796 s, 92.9 MB/s
after
dd if=/proc/$$/pagemap of=/dev/null bs=4k
0+0 records in
0+0 records out
0 bytes (0 B) copied, 2.8029e-05 s, 0.0 kB/s
page-types still works (only faster;) with this patch.
Thanks,
Fengguang
---
pagemap: early return on unmapped areas
This helps stop dumb cp/cat early instead of loop for days:
http://bugzilla.kernel.org/show_bug.cgi?id=15041
This also serves as an optimization to normal pagemap users (eg.
page-types).
CC: Andi Kleen <andi@...stfloor.org>
CC: Matt Mackall <mpm@...enic.com>
CC: <stable@...nel.org>
Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
---
fs/proc/task_mmu.c | 4 ++++
1 file changed, 4 insertions(+)
--- linux-mm.orig/fs/proc/task_mmu.c 2010-01-14 13:38:44.000000000 +0800
+++ linux-mm/fs/proc/task_mmu.c 2010-01-14 16:38:49.000000000 +0800
@@ -586,6 +586,10 @@ static int pagemap_pte_hole(unsigned lon
struct pagemapread *pm = walk->private;
unsigned long addr;
int err = 0;
+
+ if ((end - start) / PAGE_SIZE >= pm->end - pm->out)
+ return PM_END_OF_BUFFER;
+
for (addr = start; addr < end; addr += PAGE_SIZE) {
err = add_to_pagemap(addr, PM_NOT_PRESENT, pm);
if (err)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists