[lkml]   [2004]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectPATCH: Root reservations for strict overcommit
This was on my TODO list for a while and it turns out someone already fixed the
armwaving overcommit mode for the same problem. It is easy to get into a
situation where you have no overcommit and nothing can be done because there is
no memory to clean up the stable but non-useful state of the machine.

The fix is trivial and duplicated from the armwaving overcommit code path.
The last 3% of the memory can be claimed by root processes only. It isn't a
cure but it does seem to solve the real world problems - at least providing
you have enough memory for 3% to be useful 8).

--- security/commoncap.c~ 2004-08-31 15:27:46.777504736 +0100
+++ security/commoncap.c 2004-08-31 15:27:46.778504584 +0100
@@ -357,6 +357,11 @@

allowed = (totalram_pages - hugetlb_total_pages())
* sysctl_overcommit_ratio / 100;
+ /*
+ * Leave the last 3% for root
+ */
+ if (!capable(CAP_SYS_ADMIN))
+ allowed -= allowed / 32;
allowed += total_swap_pages;

if (atomic_read(&vm_committed_space) < allowed)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-03-22 14:05    [W:0.047 / U:9.232 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site