summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorAndrew Shewmaker <agshew@gmail.com>2013-04-18 09:47:09 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2013-04-23 17:17:58 +1000
commitd7450f6e9fa37defd2d6324fb34a6cf82823bf06 (patch)
treeb6d51302d8b3212707012756c39dd40d3a9b7f05 /mm
parent9a2b47c9b944dabece742635d65a1ab3b8f2a853 (diff)
mm-reinititalise-user-and-admin-reserves-if-memory-is-added-or-removed-v9
* Explanatory comments for magic numbers in memory notifier Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index b09ad723784b..5bfe583417a3 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3147,6 +3147,13 @@ module_init(init_admin_reserve)
/*
* Reinititalise user and admin reserves if memory is added or removed.
*
+ * The default user reserve max is 128MB, and the default max for the
+ * admin reserve is 8MB. These are usually, but not always, enough to
+ * enable recovery from a memory hogging process using login/sshd, a shell,
+ * and tools like top. It may make sense to increase or even disable the
+ * reserve depending on the existence of swap or variations in the recovery
+ * tools. So, the admin may have changed them.
+ *
* If memory is added and the reserves have been eliminated or increased above
* the default max, then we'll trust the admin.
*
@@ -3162,10 +3169,16 @@ static int reserve_mem_notifier(struct notifier_block *nb,
switch (action) {
case MEM_ONLINE:
+ /*
+ * Default max is 128MB. Leave alone if modified by operator.
+ */
tmp = sysctl_user_reserve_kbytes;
if (0 < tmp && tmp < (1UL << 17))
init_user_reserve();
+ /*
+ * Default max is 8MB. Leave alone if modified by operator.
+ */
tmp = sysctl_admin_reserve_kbytes;
if (0 < tmp && tmp < (1UL << 13))
init_admin_reserve();