From: Rusty Russell <rusty@rustcorp.com.au>
To: Matt Mackall <mpm@selenic.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: maps2-eliminate-the-pmd_walker-struct-in-the-page-walker.patch
Date: Sun, 08 Jul 2007 15:32:57 +1000 [thread overview]
Message-ID: <1183872777.6005.264.camel@localhost.localdomain> (raw)
Matt coded:
> diff -puN fs/proc/task_mmu.c~maps2-eliminate-the-pmd_walker-struct-in-the-page-walker fs/proc/task_mmu.c
> --- a/fs/proc/task_mmu.c~maps2-eliminate-the-pmd_walker-struct-in-the-page-walker
> +++ a/fs/proc/task_mmu.c
> @@ -116,6 +116,7 @@ static void pad_len_spaces(struct seq_fi
>
> struct mem_size_stats
> {
> + struct vm_area_struct *vma;
> unsigned long resident;
> unsigned long shared_clean;
> unsigned long shared_dirty;
Hi Matt,
I was looking at this patch, and slapping a vma in a structure called
"*_stats" is fairly ugly. How about this (applies on top):
==
mmaps2-vma-out-of-mem_size_stats.patch
Putting the vma inside "struct mem_size_stats" to hand it through the
pagewalker is a little gross. Making a separate struct is more
verbose, but clearer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
diff -r 6c7143b1a410 fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c Fri Jul 06 10:30:39 2007 +1000
+++ b/fs/proc/task_mmu.c Sun Jul 08 15:29:00 2007 +1000
@@ -318,7 +318,6 @@ const struct file_operations proc_maps_o
#ifdef CONFIG_PROC_SMAPS
struct mem_size_stats
{
- struct vm_area_struct *vma;
unsigned long resident;
unsigned long shared_clean;
unsigned long shared_dirty;
@@ -327,11 +326,18 @@ struct mem_size_stats
unsigned long referenced;
};
+struct smaps_arg
+{
+ struct mem_size_stats mss;
+ struct vm_area_struct *vma;
+};
+
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;
+ struct smaps_arg *sarg = private;
+ struct vm_area_struct *vma = sarg->vma;
+ struct mem_size_stats *mss = &sarg->mss;
pte_t *pte, ptent;
spinlock_t *ptl;
struct page *page;
@@ -373,14 +379,14 @@ static int show_smap(struct seq_file *m,
static int show_smap(struct seq_file *m, void *v)
{
struct vm_area_struct *vma = v;
- struct mem_size_stats mss;
+ struct smaps_arg sarg;
int ret;
- memset(&mss, 0, sizeof mss);
- mss.vma = vma;
+ memset(&sarg.mss, 0, sizeof sarg.mss);
+ sarg.vma = vma;
if (vma->vm_mm && !is_vm_hugetlb_page(vma))
walk_page_range(vma->vm_mm, vma->vm_start, vma->vm_end,
- &smaps_walk, &mss);
+ &smaps_walk, &sarg);
ret = show_map(m, v);
if (ret)
@@ -395,12 +401,12 @@ static int show_smap(struct seq_file *m,
"Private_Dirty: %8lu kB\n"
"Referenced: %8lu kB\n",
(vma->vm_end - vma->vm_start) >> 10,
- mss.resident >> 10,
- mss.shared_clean >> 10,
- mss.shared_dirty >> 10,
- mss.private_clean >> 10,
- mss.private_dirty >> 10,
- mss.referenced >> 10);
+ sarg.mss.resident >> 10,
+ sarg.mss.shared_clean >> 10,
+ sarg.mss.shared_dirty >> 10,
+ sarg.mss.private_clean >> 10,
+ sarg.mss.private_dirty >> 10,
+ sarg.mss.referenced >> 10);
return ret;
}
reply other threads:[~2007-07-08 5:33 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=1183872777.6005.264.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=rientjes@google.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
all inboxes | Powered by JetHome®