public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Hirtz <fhirtz@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: [patch] 2.6.8.1:  display committed memory limit and available in meminfo
Date: Thu, 19 Aug 2004 10:51:53 -0400	[thread overview]
Message-ID: <4124BE89.20909@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

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. Does such 
an addition seem reasonable?

Thank you,

Frank.

[-- Attachment #2: linux-2.6.8.1-committedmem.patch --]
[-- Type: text/plain, Size: 1124 bytes --]

--- linux-2.6.8.1/fs/proc/proc_misc.c		2004-08-18 16:32:07.000000000 -0400
+++ linux-2.6.8.1.new/fs/proc/proc_misc.c	2004-08-18 16:55:47.000000000 -0400
@@ -153,7 +153,7 @@
 				 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;
@@ -171,6 +171,8 @@
 	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();
@@ -198,7 +200,9 @@
 		"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"
@@ -220,7 +224,9 @@
 		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,

             reply	other threads:[~2004-08-19 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-19 14:51 Frank Hirtz [this message]
2004-08-24 16:53 ` [patch] 2.6.8.1: display committed memory limit and available in meminfo Frank Hirtz
2004-09-14 20:35   ` Frank Hirtz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4124BE89.20909@redhat.com \
    --to=fhirtz@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox