linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Martin J. Bligh" <mbligh@aracnet.com>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-mm mailing list <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] make vm_enough_memory more efficient
Date: Wed, 15 Jan 2003 23:47:04 -0800	[thread overview]
Message-ID: <66360000.1042703224@titus> (raw)

vm_enough_memory seems to call si_meminfo just to get the total 
RAM, which seems far too expensive. This replaces the comment
saying "this is crap" with some code that's less crap.

Not heavily tested (compiles and boots), but seems pretty obvious.

M.

diff -urpN -X /home/fletch/.diff.exclude virgin/mm/mmap.c vm_enough_memory/mm/mmap.c
--- virgin/mm/mmap.c	Mon Jan 13 21:09:28 2003
+++ vm_enough_memory/mm/mmap.c	Wed Jan 15 23:41:39 2003
@@ -72,7 +72,6 @@ inline void vm_unacct_memory(long pages)
 int vm_enough_memory(long pages)
 {
 	unsigned long free, allowed;
-	struct sysinfo i;
 
 	atomic_add(pages, &vm_committed_space);
 
@@ -113,12 +112,7 @@ int vm_enough_memory(long pages)
 		return 0;
 	}
 
-	/*
-	 * FIXME: need to add arch hooks to get the bits we need
-	 * without this higher overhead crap
-	 */
-	si_meminfo(&i);
-	allowed = i.totalram * sysctl_overcommit_ratio / 100;
+	allowed = totalram_pages * sysctl_overcommit_ratio / 100;
 	allowed += total_swap_pages;
 
 	if (atomic_read(&vm_committed_space) < allowed)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

             reply	other threads:[~2003-01-16  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-16  7:47 Martin J. Bligh [this message]
2003-01-16  8:14 ` Andrew Morton
2003-01-16 15:22   ` Martin J. Bligh

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=66360000.1042703224@titus \
    --to=mbligh@aracnet.com \
    --cc=akpm@digeo.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox