All of lore.kernel.org
 help / color / mirror / Atom feed
* + maps2-export-page-index-in-kpagemap.patch added to -mm tree
@ 2007-09-24 20:44 akpm
  2007-09-24 21:19 ` Dave Hansen
       [not found] ` <20070924205901.GI19691@waste.org>
  0 siblings, 2 replies; 9+ messages in thread
From: akpm @ 2007-09-24 20:44 UTC (permalink / raw)
  To: mm-commits; +Cc: wfg, balbir, haveblue, jjberthels, mpm


The patch titled
     maps2: export page index in kpagemap
has been added to the -mm tree.  Its filename is
     maps2-export-page-index-in-kpagemap.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: maps2: export page index in kpagemap
From: Fengguang Wu <wfg@mail.ustc.edu.cn>

To analyze/optimize the memory footprint, the number one question people
may ask about pagemap/kpagemap could be:

	Which part of the files are being actively mapped?

In the (rare) case of nonlinear mapping, that question could only be
answered by explicitly exporting the page index in kpagemap.  Simply
judging by the PFNs from pagemap could be wrong!

Cc: Matt Mackall <mpm@selenic.com>
Cc: John Berthels <jjberthels@gmail.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/proc/proc_misc.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff -puN fs/proc/proc_misc.c~maps2-export-page-index-in-kpagemap fs/proc/proc_misc.c
--- a/fs/proc/proc_misc.c~maps2-export-page-index-in-kpagemap
+++ a/fs/proc/proc_misc.c
@@ -672,8 +672,8 @@ static const struct file_operations proc
 #endif
 
 #ifdef CONFIG_PROC_PAGE_MONITOR
-#define KPMSIZE (sizeof(unsigned long) * 2)
-#define KPMMASK (KPMSIZE - 1)
+#define KPMITEMS 3
+#define KPMSIZE (sizeof(unsigned long) * KPMITEMS)
 /* /proc/kpagemap - an array exposing page flags and counts
  *
  * Each entry is a pair of unsigned longs representing the
@@ -699,7 +699,7 @@ static ssize_t kpagemap_read(struct file
 
 	pfn = src / KPMSIZE - 1;
 	count = min_t(unsigned long, count, ((max_pfn + 1) * KPMSIZE) - src);
-	if (src & KPMMASK || count & KPMMASK)
+	if (src % KPMITEMS || count % KPMITEMS)
 		return -EIO;
 
 	page = (unsigned long *)__get_free_page(GFP_USER);
@@ -713,25 +713,28 @@ static ssize_t kpagemap_read(struct file
 		if (pfn == -1) {
 			page[0] = 0;
 			page[1] = 0;
+			page[2] = 0;
 			((char *)page)[0] = (ntohl(1) != 1);
 			((char *)page)[1] = PAGE_SHIFT;
 			((char *)page)[2] = sizeof(unsigned long);
 			((char *)page)[3] = KPMSIZE;
-			i = 2;
+			i = KPMITEMS;
 			pfn++;
 		}
 
-		for (; i < 2 * chunk / KPMSIZE; i += 2, pfn++) {
+		for (; i < KPMITEMS * chunk / KPMSIZE; i += KPMITEMS, pfn++) {
 			ppage = pfn_to_page(pfn);
 			if (!ppage) {
 				page[i] = 0;
 				page[i + 1] = 0;
+				page[i + 2] = 0;
 			} else {
 				page[i] = ppage->flags;
 				page[i + 1] = atomic_read(&ppage->_count);
+				page[i + 2] = page_index(ppage);
 			}
 		}
-		chunk = (i / 2) * KPMSIZE;
+		chunk = (i / KPMITEMS) * KPMSIZE;
 
 		if (copy_to_user(buf, page, chunk)) {
 			ret = -EFAULT;
_

Patches currently in -mm which might be from wfg@mail.ustc.edu.cn are

readahead-compacting-file_ra_state.patch
readahead-mmap-read-around-simplification.patch
readahead-combine-file_ra_stateprev_index-prev_offset-into-prev_pos.patch
readahead-combine-file_ra_stateprev_index-prev_offset-into-prev_pos-fix.patch
readahead-combine-file_ra_stateprev_index-prev_offset-into-prev_pos-fix-2.patch
radixtree-introduce-radix_tree_next_hole.patch
readahead-basic-support-of-interleaved-reads.patch
readahead-remove-the-local-copy-of-ra-in-do_generic_mapping_read.patch
readahead-remove-several-readahead-macros.patch
readahead-remove-the-limit-max_sectors_kb-imposed-on-max_readahead_kb.patch
filemap-trivial-code-cleanups.patch
filemap-convert-some-unsigned-long-to-pgoff_t.patch
make-swappiness-safer-to-use.patch
maps2-export-page-index-in-kpagemap.patch
maps-pssproportional-set-size-accounting-in-smaps.patch
convert-ill-defined-log2-to-ilog2.patch
seqfile-merge-duplite-code-to-seq_open_private.patch
avoid-negative-and-full-width-shifts-in-radix-treec.patch

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-09-25  9:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-24 20:44 + maps2-export-page-index-in-kpagemap.patch added to -mm tree akpm
2007-09-24 21:19 ` Dave Hansen
     [not found] ` <20070924205901.GI19691@waste.org>
2007-09-24 21:23   ` Dave Hansen
2007-09-24 21:35     ` Matt Mackall
2007-09-24 21:50       ` Dave Hansen
2007-09-24 22:02         ` Matt Mackall
2007-09-25  7:19           ` Fengguang Wu
2007-09-25  7:19             ` Fengguang Wu
2007-09-25  8:17               ` Balbir Singh
2007-09-25  9:58                 ` filecache: expose what's in the page cache Fengguang Wu
2007-09-25  9:58                   ` Fengguang Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.