mm: replace hardcoded 3% with admin_reserve_pages knob
Subsystems (5)
PATCH v4 2/2 mm: replace hardcoded 3% with admin_reserve_pages knob
Add an admin_reserve_pages knob to allow admins of large memory systems to change the hardcoded memory reserve to something other than 3%. This affects OVERCOMMIT_GUESS and OVERCOMMIT_NEVER.
admin_reserve_pages is initialized to min(3% free pages, 8MB)
Signed-off-by Andrew Shewmaker <[email protected]>
---
Rebased onto v3.8-mmotm-2013-03-01-15-50
Code duplicated for nommu.
Documentation/sysctl/vm.txt | 16 ++++++++++++++ include/linux/mm.h | 2 + kernel/sysctl.c | 8 +++++++ mm/mmap.c | 50 ++++++++++++++++++++++++++++++++++++++++---- mm/nommu.c | 50 ++++++++++++++++++++++++++++++++++++++++----
Documentation/sysctl/vm.txt +16 -0
@@ -18,6 +18,7 @@ files can be found in mm/swap.c. Currently, these files are in /proc/sys/vm: +- admin_reserve_pages - block_dump - compact_memory - dirty_background_bytes
@@ -649,6 +650,21 @@ the high water marks for each per cpu page list. ============================================================== +admin_reserve_pages + +The number of free pages in the system that should be reserved for users +with the capability cap_sys_admin. The default value is the smaller of 3% +of free pages or 2000 pages (8MB with 4k pages). 8MB should provide +enough for the admin to log in and kill a process if necessary. + +Systems running with overcommit disabled should consider increasing this +to account for the full Virtual Memory Size of programs used to recover +a system. + +Changing this takes effect whenever an application requests memory. + +============================================================== + stat_interval The time interval between which vm statistics are updated. The default
include/linux/mm.h +2 -0
@@ -1677,6 +1677,8 @@ int in_gate_area_no_mm(unsigned long addr);int drop_caches_sysctl_handler (struct ctl_table *,int ,void __user *,size_t *,loff_t *); +int admin_reserve_pages_sysctl_handler (struct ctl_table *,int , +void __user *,size_t *,loff_t *);unsigned long shrink_slab (struct shrink_control *shrink,unsigned long nr_pages_scanned,unsigned long lru_pages);
kernel/sysctl.c +8 -0
@@ -97,6 +97,7 @@/* External variables not in a header file. */ extern int sysctl_overcommit_memory;extern int sysctl_overcommit_ratio; +extern int sysctl_admin_reserve_pages;extern int max_threads;extern int suid_dumpable;#ifdef CONFIG_COREDUMP
@@ -1430,6 +1431,13 @@ static struct ctl_table vm_table[] = { .extra2 = &one, },#endif + { + .procname = "admin_reserve_pages", + .data = &sysctl_admin_reserve_pages, + .maxlen = sizeof(sysctl_admin_reserve_pages), + .mode = 0644, + .proc_handler = admin_reserve_pages_sysctl_handler, + }, { } };
mm/mmap.c +46 -4
81 lines not on this page · raw message
mm/nommu.c +46 -4
81 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>