From: "Wang, Yalin" <Yalin.Wang@sonymobile.com>
To: "'akpm@linux-foundation.org'" <akpm@linux-foundation.org>,
"'kirill.shutemov@linux.intel.com'"
<kirill.shutemov@linux.intel.com>,
"'oleg@redhat.com'" <oleg@redhat.com>,
"'gorcunov@openvz.org'" <gorcunov@openvz.org>,
"'n-horiguchi@ah.jp.nec.com'" <n-horiguchi@ah.jp.nec.com>,
"'pfeiner@google.com'" <pfeiner@google.com>,
"'aquini@redhat.com'" <aquini@redhat.com>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: [RFC V2] mm:change smaps/pagemap_read calculation behavior
Date: Fri, 30 Jan 2015 15:47:54 +0800 [thread overview]
Message-ID: <35FD53F367049845BC99AC72306C23D1044A02027E06@CNBJMBX05.corpusers.net> (raw)
In-Reply-To: <35FD53F367049845BC99AC72306C23D1044A02027E04@CNBJMBX05.corpusers.net>
This patch change smaps/pagemap_read pagetable walk behavior, to make
sure not skip VM_PFNMAP pagetables,
so that we can calculate COW pages of VM_PFNMAP as normal pages.
Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
---
fs/proc/task_mmu.c | 2 ++
include/linux/mm.h | 2 ++
mm/pagewalk.c | 5 +++++
3 files changed, 9 insertions(+)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index c7267e9..e7d7c43 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -616,6 +616,7 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
struct mem_size_stats mss;
struct mm_walk smaps_walk = {
.pmd_entry = smaps_pte_range,
+ .test_walk = generic_walk_page_test_no_skip,
.mm = vma->vm_mm,
.private = &mss,
};
@@ -1264,6 +1265,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
pagemap_walk.pmd_entry = pagemap_pte_range;
pagemap_walk.pte_hole = pagemap_pte_hole;
+ pagemap_walk.test_walk = generic_walk_page_test_no_skip;
#ifdef CONFIG_HUGETLB_PAGE
pagemap_walk.hugetlb_entry = pagemap_hugetlb_range;
#endif
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b976d9f..07f71c5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1191,6 +1191,8 @@ struct mm_walk {
void *private;
};
+int generic_walk_page_test_no_skip(unsigned long start, unsigned long end,
+ struct mm_walk *walk);
int walk_page_range(unsigned long addr, unsigned long end,
struct mm_walk *walk);
int walk_page_vma(struct vm_area_struct *vma, struct mm_walk *walk);
diff --git a/mm/pagewalk.c b/mm/pagewalk.c
index 75c1f28..14f38d5 100644
--- a/mm/pagewalk.c
+++ b/mm/pagewalk.c
@@ -206,6 +206,11 @@ static int __walk_page_range(unsigned long start, unsigned long end,
return err;
}
+int generic_walk_page_test_no_skip(unsigned long start, unsigned long end,
+ struct mm_walk *walk)
+{
+ return 0;
+}
/**
* walk_page_range - walk page table with caller specific callbacks
*
--
2.2.2
next prev parent reply other threads:[~2015-01-30 7:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 6:14 [RFC] mm:change /proc/smaps caculation behavior Wang, Yalin
2015-01-30 7:47 ` Wang, Yalin [this message]
2015-01-30 8:23 ` [RFC V2] mm:change smaps/pagemap_read calculation behavior Naoya Horiguchi
2015-01-30 9:15 ` Wang, Yalin
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=35FD53F367049845BC99AC72306C23D1044A02027E06@CNBJMBX05.corpusers.net \
--to=yalin.wang@sonymobile.com \
--cc=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=gorcunov@openvz.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=oleg@redhat.com \
--cc=pfeiner@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®