[procfs] [1/1] fix task_mmu.c text size reporting

From: William Lee Irwin III
Date: Mon Sep 13 2004 - 22:01:57 EST


On Mon, Sep 13, 2004 at 01:50:03AM -0700, Andrew Morton wrote:
> Due to master.kernel.org being on the blink, 2.6.9-rc1-mm5 Is currently at
> http://www.zip.com.au/~akpm/linux/patches/2.6.9-rc1-mm5/
> and will later appear at
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.9-rc1/2.6.9-rc1-mm5/
> Please check kernel.org before using zip.com.au.

Not all binfmts page align ->end_code and ->start_code, so the task_mmu
statistics calculations need to perform this allocation themselves.

Index: mm5-2.6.9-rc1/fs/proc/task_mmu.c
===================================================================
--- mm5-2.6.9-rc1.orig/fs/proc/task_mmu.c 2004-09-13 16:27:35.915357248 -0700
+++ mm5-2.6.9-rc1/fs/proc/task_mmu.c 2004-09-13 19:43:19.681033496 -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 & PAGE_MASK)) >> 10;
lib = (mm->exec_vm << (PAGE_SHIFT-10)) - text;
buffer += sprintf(buffer,
"VmSize:\t%8lu kB\n"
@@ -36,7 +36,8 @@
int *data, int *resident)
{
*shared = mm->shared_vm;
- *text = (mm->end_code - mm->start_code) >> PAGE_SHIFT;
+ *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK))
+ >> PAGE_SHIFT;
*data = mm->total_vm - mm->shared_vm - *text;
*resident = mm->rss;
return mm->total_vm;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/