[3/2] round up text memory to the nearest page in fs/proc/task_mmu.c

William Lee Irwin III
2004-09-09T01:27:53Z

On Wed, Sep 08, 2004 at 06:21:37PM -0700, William Lee Irwin III wrote:
> Make __task_mem() and __task_mem_cheap() use the appropriate methods
> for CONFIG_MMU=y and add some attempt at correct code for CONFIG_MMU=n.
> The new methods for /proc/ accounting involve using counters kept in
> the mm instead of iteration over vmas. For the CONFIG_MMU=y case this
> does not involve acquiring mm->mmap_sem for any per-mm statistics. The
> CONFIG_MMU=n case still needs iteration over tblocks to calculate them.

Round up text memory to the nearest page to resolve potential alignment
anomalies in reported statistics. Compiletested on ia64.

-- wli

Index: mm4-2.6.9-rc1/fs/proc/task_mmu.c
===================================================================
--- mm4-2.6.9-rc1.orig/fs/proc/task_mmu.c 2004-09-08 06:10:35.000000000 -0700
+++ mm4-2.6.9-rc1/fs/proc/task_mmu.c 2004-09-08 18:27:39.401017905 -0700
@@ -9,7 +9,7 @@
unsigned long data, text, lib;

data = mm->total_vm - mm->shared_vm - mm->stack_vm;
- text = (mm->end_code - mm->start_code) >> 10;
+ text = PAGE_ALIGN(mm->end_code - mm->start_code) >> 10;
lib = (mm->exec_vm << (PAGE_SHIFT-10)) - text;
buffer += sprintf(buffer,
"VmSize:\t%8lu kB\n"