Re: [PATCH 2.6.14-rc2] fix incorrect mm->hiwater_vm and mm->hiwater_rss

From: Jay Lan
Date: Wed Sep 21 2005 - 13:39:19 EST


Frank van Maarseveen wrote:
On Wed, Sep 21, 2005 at 10:39:01AM -0700, Jay Lan wrote:

Frank's patch looks fine to me except one place:
diff -ru a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c 2005-09-21 11:07:40.000000000 +0200
+++ b/mm/mmap.c 2005-09-21 11:17:06.755572000 +0200
@@ -854,6 +854,7 @@
mm->stack_vm += pages;
if (flags & (VM_RESERVED|VM_IO))
mm->reserved_vm += pages;
+ update_mem_hiwater(mm);
}
#endif /* CONFIG_PROC_FS */

I have a question of adding this call here. 'update_mem_hiwater'
does nothing unless mm->total_vm or rss gets updated.
I do not see total_vm get updates in __vm_stat_account()?


Check the callers of __vm_stat_account(). It is called at various places
after increasing (sometimes decreasing) vm_total.

Sounds good.

- jay



BTW, __vm_stat_account() itself is surrounded by #ifdef CONFIG_PROC_FS so
I'd thought that that might be appropriate for hiwater_* too. So far they are
set but are not read except by my patch for /proc/pid/status. >
in 2.6.13.2:

$ find -type f|xargs grep hiwater_rss
./kernel/fork.c: mm->hiwater_rss = get_mm_counter(mm,rss);
./include/linux/sched.h: unsigned long hiwater_rss; /* High-water RSS usage */
./mm/memory.c: if (tsk->mm->hiwater_rss < rss)
./mm/memory.c: tsk->mm->hiwater_rss = rss;
./mm/nommu.c: if (tsk->mm->hiwater_rss < rss)
./mm/nommu.c: tsk->mm->hiwater_rss = rss;

$ find -type f|xargs grep hiwater_vm ./kernel/fork.c: mm->hiwater_vm = mm->total_vm;
./include/linux/sched.h: unsigned long hiwater_vm; /* High-water virtual memory usage */
./mm/memory.c: if (tsk->mm->hiwater_vm < tsk->mm->total_vm)
./mm/memory.c: tsk->mm->hiwater_vm = tsk->mm->total_vm;
./mm/nommu.c: if (tsk->mm->hiwater_vm < tsk->mm->total_vm)
./mm/nommu.c: tsk->mm->hiwater_vm = tsk->mm->total_vm;

The matches in mm/memory.c and mm/nommu.c are in function update_mem_hiwater().


-
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/