Messages in this thread | | | Date | Mon, 10 Jan 2005 10:35:26 -0400 | From | Mauricio Lin <> | Subject | Re: [PATCH] A new entry for /proc |
| |
On Thu, 6 Jan 2005 20:23:39 -0800, Andrew Morton <akpm@osdl.org> wrote: > Mauricio Lin <mauriciolin@gmail.com> wrote: > > > > Here is a new entry developed for /proc that prints for each process > > memory area (VMA) the size of rss. The maps from original kernel is > > able to present the virtual size for each vma, but not the physical > > size (rss). This entry can provide an additional information for tools > > that analyze the memory consumption. You can know the physical memory > > size of each library used by a process and also the executable file. > > > > Take a look the output: > > # cat /proc/877/smaps > > 08048000-08132000 r-xp /usr/bin/xmms > > Size: 936 kB > > Rss: 788 kB > > This is potentially quite useful. I'd be interested in what others think of > the idea and implementation. > > > Here is the patch: > > - It was wordwrapped. Mail the patch to yourself first, make sure it > still applies. > > - Prepare patches with `diff -u' OK. > > - > > > + extern struct seq_operations proc_pid_smaps_op; > > Put extern headers in .h files, not in .c. OK. > > > > + static void resident_mem_size(struct mm_struct *mm, unsigned long > > start_address, > > + unsigned long end_address, unsigned long *size) { > > + pgd_t *pgd; > > + pmd_t *pmd; > > + pte_t *ptep, pte; > > + unsigned long page; > > The identifier `page' is usually used for pointers to struct page. Please > pick another name? OK. > > > + if (pte_present(pte)) { > > + *size += PAGE_SIZE; > > + } > > We prefer to omit the braces if they enclose only a single statement. > > > + if (map->vm_file) { > > + len = sizeof(void*) * 6 - len; > > + if (len < 1) > > + len = 1; > > + seq_printf(m, "%*c", len, ' '); > > + seq_path(m, file->f_vfsmnt, file->f_dentry, " \t\n\\"); > > + } > > hm, that's a bit bizarre. Isn't there a printf construct which will do the > right-alignment for you? %8u? (See meminfo_read_proc()) OK, we will follow your suggestion. This was an informal PATCH, just to present the idea of this work for the list. So the mistakes you pointed will be fixed and I will send to the list a more formal PATCH with the developers names attached. OK? > > - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |