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@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxx> Cc: John Berthels <jjberthels@xxxxxxxxx> Cc: Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> Signed-off-by: Fengguang Wu <wfg@xxxxxxxxxxxxxxxx> Cc: Dave Hansen <haveblue@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- 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@xxxxxxxxxxxxxxxx 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 - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html