From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 4/13] maps: Propagate errors from callback in page walker
Date: Tue, 03 Apr 2007 21:43:34 -0500 [thread overview]
Message-ID: <5.486631555@selenic.com> (raw)
In-Reply-To: <1.486631555@selenic.com>
Propagate errors from callback in page walker
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: mm/fs/proc/task_mmu.c
===================================================================
--- mm.orig/fs/proc/task_mmu.c 2007-03-24 21:33:52.000000000 -0500
+++ mm/fs/proc/task_mmu.c 2007-03-24 21:33:58.000000000 -0500
@@ -212,8 +212,8 @@ static int show_map(struct seq_file *m,
return show_map_internal(m, v, NULL);
}
-static void smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
- void *private)
+static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
+ void *private)
{
struct mem_size_stats *mss = private;
struct vm_area_struct *vma = mss->vma;
@@ -250,10 +250,11 @@ static void smaps_pte_range(pmd_t *pmd,
}
pte_unmap_unlock(pte - 1, ptl);
cond_resched();
+ return 0;
}
-static void clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
- unsigned long end, void *private)
+static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
+ unsigned long end, void *private)
{
struct vm_area_struct *vma = private;
pte_t *pte, ptent;
@@ -276,40 +277,51 @@ static void clear_refs_pte_range(pmd_t *
}
pte_unmap_unlock(pte - 1, ptl);
cond_resched();
+ return 0;
}
-static void walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
- void (*action)(pmd_t *, unsigned long,
- unsigned long, void *),
- void *private)
+static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
+ int (*action)(pmd_t *, unsigned long,
+ unsigned long, void *),
+ void *private)
{
pmd_t *pmd;
unsigned long next;
+ int err;
for (pmd = pmd_offset(pud, addr); addr != end;
pmd++, addr = next) {
next = pmd_addr_end(addr, end);
if (pmd_none_or_clear_bad(pmd))
continue;
- action(pmd, addr, next, private);
+ err = action(pmd, addr, next, private);
+ if (err)
+ return err;
}
+
+ return 0;
}
-static void walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
- void (*action)(pmd_t *, unsigned long,
- unsigned long, void *),
- void *private)
+static int walk_pud_range(pgd_t *pgd, unsigned long addr, unsigned long end,
+ int (*action)(pmd_t *, unsigned long,
+ unsigned long, void *),
+ void *private)
{
pud_t *pud;
unsigned long next;
+ int err;
for (pud = pud_offset(pgd, addr); addr != end;
pud++, addr = next) {
next = pud_addr_end(addr, end);
if (pud_none_or_clear_bad(pud))
continue;
- walk_pmd_range(pud, addr, next, action, private);
+ err = walk_pmd_range(pud, addr, next, action, private);
+ if (err)
+ return err;
}
+
+ return 0;
}
/*
@@ -323,22 +335,27 @@ static void walk_pud_range(pgd_t *pgd, u
* Recursively walk the page table for the memory area in a VMA, calling
* a callback for every bottom-level (PTE) page table.
*/
-static void walk_page_range(struct mm_struct *mm,
- unsigned long addr, unsigned long end,
- void (*action)(pmd_t *, unsigned long,
- unsigned long, void *),
- void *private)
+static int walk_page_range(struct mm_struct *mm,
+ unsigned long addr, unsigned long end,
+ int (*action)(pmd_t *, unsigned long,
+ unsigned long, void *),
+ void *private)
{
pgd_t *pgd;
unsigned long next;
+ int err;
for (pgd = pgd_offset(mm, addr); addr != end;
pgd++, addr = next) {
next = pgd_addr_end(addr, end);
if (pgd_none_or_clear_bad(pgd))
continue;
- walk_pud_range(pgd, addr, next, action, private);
+ err = walk_pud_range(pgd, addr, next, action, private);
+ if (err)
+ return err;
}
+
+ return 0;
}
static int show_smap(struct seq_file *m, void *v)
next prev parent reply other threads:[~2007-04-04 2:42 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-04 2:43 [PATCH 0/13] maps: pagemap, kpagemap, and related cleanups Matt Mackall
2007-04-04 2:43 ` [PATCH 1/13] maps: Uninline some functions in the page walker Matt Mackall
2007-04-04 2:43 ` [PATCH 2/13] maps: Eliminate the pmd_walker struct " Matt Mackall
2007-04-04 2:43 ` [PATCH 3/13] maps: Remove vma from args " Matt Mackall
2007-04-04 2:43 ` Matt Mackall [this message]
2007-04-04 2:43 ` [PATCH 5/13] maps: Add callbacks for each level to " Matt Mackall
2007-04-04 2:43 ` [PATCH 6/13] maps: Move the page walker code to lib/ Matt Mackall
2007-04-04 3:51 ` Nick Piggin
2007-04-04 5:08 ` Matt Mackall
2007-04-04 5:50 ` Nick Piggin
2007-04-04 21:48 ` Matt Mackall
2007-04-05 1:32 ` Nick Piggin
2007-04-05 1:50 ` Nick Piggin
2007-04-04 2:43 ` [PATCH 7/13] maps: Simplify interdependence of /proc/pid/maps and smaps Matt Mackall
2007-04-04 2:43 ` [PATCH 8/13] maps: Move clear_refs code to task_mmu.c Matt Mackall
2007-04-04 2:43 ` [PATCH 9/13] maps: Regroup task_mmu by interface Matt Mackall
2007-04-04 2:43 ` [PATCH 10/13] maps: Make /proc/pid/smaps optional under CONFIG_EMBEDDED Matt Mackall
2007-04-04 2:43 ` [PATCH 11/13] maps: Make /proc/pid/clear_refs option " Matt Mackall
2007-04-04 6:22 ` David Rientjes
2007-04-04 2:43 ` [PATCH 12/13] maps: Add /proc/pid/pagemap interface Matt Mackall
2007-04-04 11:18 ` Nikita Danilov
2007-04-04 16:32 ` Matt Mackall
2007-04-04 18:03 ` Nikita Danilov
2007-04-04 21:59 ` Matt Mackall
2007-04-04 2:43 ` [PATCH 13/13] maps: Add /proc/kpagemap interface Matt Mackall
2007-04-12 23:10 ` [PATCH 0/13] maps: pagemap, kpagemap, and related cleanups William Lee Irwin III
2007-04-12 23:32 ` Andrew Morton
2007-04-12 23:42 ` William Lee Irwin III
2007-04-13 0:25 ` Nick Piggin
2007-04-13 0:15 ` Nick Piggin
2007-04-13 0:25 ` Matt Mackall
2007-04-13 1:01 ` Nick Piggin
2007-04-13 1:38 ` Matt Mackall
2007-04-13 2:11 ` Nick Piggin
2007-04-13 0:42 ` Andrew Morton
2007-04-13 1:14 ` Nick Piggin
2007-04-13 1:22 ` Andrew Morton
2007-04-13 1:42 ` Nick Piggin
2007-04-13 1:57 ` Matt Mackall
2007-04-13 2:21 ` Nick Piggin
2007-04-13 2:23 ` Matt Mackall
2007-04-13 2:54 ` Nick Piggin
2007-04-13 12:24 ` Ananth N Mavinakayanahalli
2007-04-14 8:13 ` Maneesh Soni
2007-04-13 1:57 ` Andrew Morton
2007-04-13 2:05 ` Matt Mackall
2007-04-13 2:29 ` Nick Piggin
2007-04-13 2:18 ` Nick Piggin
2007-04-13 2:32 ` Andrew Morton
2007-04-13 2:50 ` Nick Piggin
2007-04-13 3:10 ` Nick Piggin
2007-04-13 6:53 ` William Lee Irwin III
2007-04-13 7:05 ` Nick Piggin
2007-04-13 7:51 ` Christoph Hellwig
2007-04-13 8:03 ` Nick Piggin
2007-04-13 8:13 ` Christoph Hellwig
2007-04-13 8:25 ` Nick Piggin
2007-04-13 9:46 ` Christoph Hellwig
2007-04-13 21:17 ` Frank Ch. Eigler
2007-04-16 10:59 ` Christoph Hellwig
2007-04-16 21:36 ` Andi Kleen
2007-04-16 21:01 ` Frank Ch. Eigler
2007-04-13 8:15 ` William Lee Irwin III
2007-04-13 12:13 ` Ananth N Mavinakayanahalli
2007-04-13 12:46 ` Nick Piggin
2007-04-13 3:40 ` Nick Piggin
2007-04-13 6:55 ` William Lee Irwin III
2007-04-13 7:03 ` Nick Piggin
2007-04-13 7:08 ` William Lee Irwin III
2007-04-13 14:08 ` Theodore Tso
2007-04-16 11:00 ` Christoph Hellwig
2007-04-13 17:13 ` Matt Mackall
2007-04-13 16:24 ` Matt Mackall
2007-04-13 17:03 ` Andrew Morton
2007-04-13 17:24 ` Matt Mackall
2007-04-13 17:58 ` Andrew Morton
2007-04-13 0:15 ` Matt Mackall
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=5.486631555@selenic.com \
--to=mpm@selenic.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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