Re: [PATCH v8 2/3] mm: replace hardcoded 3% withadmin_reserve_pages knob

From: Andrew Morton
Date: Mon Apr 08 2013 - 15:39:18 EST


On Mon, 8 Apr 2013 15:05:10 -0400 Andrew Shewmaker <agshew@xxxxxxxxx> wrote:

> Add an admin_reserve_kbytes knob to allow admins to change the
> hardcoded memory reserve to something other than 3%, which
> may be multiple gigabytes on large memory systems. Only about
> 8MB is necessary to enable recovery in the default mode, and
> only a few hundred MB are required even when overcommit is
> disabled.

And the only change that v8 made was to revert earlier fixes, so I'll
skip this version as well.

--- a/include/linux/mm.h~mm-replace-hardcoded-3%-with-admin_reserve_pages-knob-v8
+++ a/include/linux/mm.h
@@ -45,7 +45,6 @@ extern int sysctl_legacy_va_layout;
#include <asm/processor.h>

extern unsigned long sysctl_user_reserve_kbytes;
-extern unsigned long sysctl_admin_reserve_kbytes;

#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))

--- a/kernel/sysctl.c~mm-replace-hardcoded-3%-with-admin_reserve_pages-knob-v8
+++ a/kernel/sysctl.c
@@ -97,6 +97,7 @@
/* External variables not in a header file. */
extern int sysctl_overcommit_memory;
extern int sysctl_overcommit_ratio;
+extern unsigned long sysctl_admin_reserve_kbytes;
extern int max_threads;
extern int suid_dumpable;
#ifdef CONFIG_COREDUMP
--- a/mm/mmap.c~mm-replace-hardcoded-3%-with-admin_reserve_pages-knob-v8
+++ a/mm/mmap.c
@@ -168,7 +168,7 @@ int __vm_enough_memory(struct mm_struct
* Reserve some for root
*/
if (!cap_sys_admin)
- free -= sysctl_admin_reserve_kbytes >> (PAGE_SHIFT - 10);
+ free -= sysctl_admin_reserve_kbytes >> (PAGE_SHIFT - 10);

if (free > pages)
return 0;
--- a/mm/nommu.c~mm-replace-hardcoded-3%-with-admin_reserve_pages-knob-v8
+++ a/mm/nommu.c
@@ -1932,7 +1932,7 @@ int __vm_enough_memory(struct mm_struct
* Reserve some for root
*/
if (!cap_sys_admin)
- free -= sysctl_admin_reserve_kbytes >> (PAGE_SHIFT - 10);
+ free -= sysctl_admin_reserve_kbytes >> (PAGE_SHIFT - 10);

if (free > pages)
return 0;
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/