Commit 688aaef8 authored by Martin J. Bligh's avatar Martin J. Bligh Committed by Linus Torvalds

[PATCH] make vm_enough_memory more efficient

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.
parent 85850b21
...@@ -72,7 +72,6 @@ inline void vm_unacct_memory(long pages) ...@@ -72,7 +72,6 @@ inline void vm_unacct_memory(long pages)
int vm_enough_memory(long pages) int vm_enough_memory(long pages)
{ {
unsigned long free, allowed; unsigned long free, allowed;
struct sysinfo i;
atomic_add(pages, &vm_committed_space); atomic_add(pages, &vm_committed_space);
...@@ -113,12 +112,7 @@ int vm_enough_memory(long pages) ...@@ -113,12 +112,7 @@ int vm_enough_memory(long pages)
return 0; return 0;
} }
/* allowed = totalram_pages * sysctl_overcommit_ratio / 100;
* 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 += total_swap_pages; allowed += total_swap_pages;
if (atomic_read(&vm_committed_space) < allowed) if (atomic_read(&vm_committed_space) < allowed)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment