All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make vm_enough_memory more efficient
@ 2003-01-16  7:47 ` Martin J. Bligh
  0 siblings, 0 replies; 6+ messages in thread
From: Martin J. Bligh @ 2003-01-16  7:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm mailing list, linux-kernel

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)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-01-16 15:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-16  7:47 [PATCH] make vm_enough_memory more efficient Martin J. Bligh
2003-01-16  7:47 ` Martin J. Bligh
2003-01-16  8:14 ` Andrew Morton
2003-01-16  8:14   ` Andrew Morton
2003-01-16 15:22   ` Martin J. Bligh
2003-01-16 15:22     ` Martin J. Bligh

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.