From: Hideo AOKI <haoki@redhat.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [patch 3/3] mm: An enhancement of OVERCOMMIT_GUESS
Date: Wed, 05 Apr 2006 19:48:18 -0400 [thread overview]
Message-ID: <44345742.8070109@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
There is a copy of __vm_enough_memory() in mm/nommu.c. I believe that
this enhancement is useful for nommu environment too.
---
Hideo Aoki, Hitachi Computer Products (America) Inc.
[-- Attachment #2: mm-consider_rsvpgs-nommu.patch --]
[-- Type: text/x-patch, Size: 1394 bytes --]
This patch is an enhancement of OVERCOMMIT_GUESS algorithm in
__vm_enough_memory() in mm/nommu.c.
When the OVERCOMMIT_GUESS algorithm calculates the number of free
pages, the algorithm subtracts the number of reserved pages from
the result nr_free_pages().
Signed-off-by: Hideo Aoki <haoki@redhat.com>
---
nommu.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff -purN linux-2.6.17-rc1-mm1/mm/nommu.c linux-2.6.17-rc1-mm1-idea6/mm/nommu.c
--- linux-2.6.17-rc1-mm1/mm/nommu.c 2006-04-04 10:43:30.000000000 -0400
+++ linux-2.6.17-rc1-mm1-idea6/mm/nommu.c 2006-04-04 15:09:24.000000000 -0400
@@ -1147,14 +1147,26 @@ int __vm_enough_memory(long pages, int c
* only call if we're about to fail.
*/
n = nr_free_pages();
+
+ /*
+ * Leave reserved pages. The pages are not for anonymous pages.
+ */
+ if (n <= totalreserve_pages)
+ goto error;
+ else
+ n -= totalreserve_pages;
+
+ /*
+ * Leave the last 3% for root
+ */
if (!cap_sys_admin)
n -= n / 32;
free += n;
if (free > pages)
return 0;
- vm_unacct_memory(pages);
- return -ENOMEM;
+
+ goto error;
}
allowed = totalram_pages * sysctl_overcommit_ratio / 100;
@@ -1175,7 +1187,7 @@ int __vm_enough_memory(long pages, int c
*/
if (atomic_read(&vm_committed_space) < (long)allowed)
return 0;
-
+error:
vm_unacct_memory(pages);
return -ENOMEM;
reply other threads:[~2006-04-05 23:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=44345742.8070109@redhat.com \
--to=haoki@redhat.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.