From: Frank Hirtz The following patch will have the committed memory limit (per the current overcommit ratio) and the amount of memory remaining under this limit displayed in meminfo. It's presently somewhat difficult to use the strict memory overcommit settings as it's somewhat difficult to determine the amount of memory remaining under the cap. This patch would make using strict overcommit a good bit simpler. Signed-off-by: Andrew Morton --- 25-akpm/fs/proc/proc_misc.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) diff -puN fs/proc/proc_misc.c~display-committed-memory-limit-and-available-in-meminfo fs/proc/proc_misc.c --- 25/fs/proc/proc_misc.c~display-committed-memory-limit-and-available-in-meminfo Thu Sep 30 16:52:13 2004 +++ 25-akpm/fs/proc/proc_misc.c Thu Sep 30 16:52:13 2004 @@ -154,7 +154,7 @@ static int meminfo_read_proc(char *page, int count, int *eof, void *data) { struct sysinfo i; - int len, committed; + int len, committed, allowed; struct page_state ps; unsigned long inactive; unsigned long active; @@ -172,6 +172,8 @@ static int meminfo_read_proc(char *page, si_meminfo(&i); si_swapinfo(&i); committed = atomic_read(&vm_committed_space); + allowed = ((totalram_pages - hugetlb_total_pages()) + * sysctl_overcommit_ratio / 100) + total_swap_pages; vmtot = (VMALLOC_END-VMALLOC_START)>>10; vmi = get_vmalloc_info(); @@ -199,7 +201,9 @@ static int meminfo_read_proc(char *page, "Writeback: %8lu kB\n" "Mapped: %8lu kB\n" "Slab: %8lu kB\n" + "CommitLimit: %8lu kB\n" "Committed_AS: %8u kB\n" + "CommitAvail: %8ld kB\n" "PageTables: %8lu kB\n" "VmallocTotal: %8lu kB\n" "VmallocUsed: %8lu kB\n" @@ -221,7 +225,9 @@ static int meminfo_read_proc(char *page, K(ps.nr_writeback), K(ps.nr_mapped), K(ps.nr_slab), + K(allowed), K(committed), + K(allowed - committed), K(ps.nr_page_table_pages), vmtot, vmi.used, _