path: root/kernel-features.c
diff options
authorMel Gorman <mel@csn.ul.ie>2010-05-11 12:02:58 +0100
committerEric B Munson <ebmunson@us.ibm.com>2010-05-13 08:51:59 +0100
commit0981d466720a1bff52ecdddc07e96af27a4196d0 (patch)
tree86486fc9a9dc42ae02aa46d57c42f87525d2b7ed /kernel-features.c
parent7607aa00e00fcf96e57da8b94eaef08c7e69060f (diff)
Allow MAP_NORESERVE to be used for mappings
Since 2.6.27-rc1, the kernel makes reservations for mappings at mmap() time. This guarantees that the process that successfully calls mmap() will successfully fault all pages within that region. This is nice reliable behaviour but it can be the case the program wants to create a very large sparse mapping. In this case, mmap() will fail even if the program knows the huge pages are available. This patch introduces a --no-reserve switch that uses MAP_NORESERVE. mmap() will always succeed but the fault might not. Unfortunately, on older kernels, use of MAP_NORESERVE can trigger the OOM killer. Hence, this patch also checks the kernel version and only allows use of MAP_NORESERVE if it's safe to do so. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Acked-by: Eric B Munson <ebmunson@us.ibm.com> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
Diffstat (limited to 'kernel-features.c')
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel-features.c b/kernel-features.c
index 4bb0149..68bc8f9 100644
--- a/kernel-features.c
+++ b/kernel-features.c
@@ -41,6 +41,10 @@ static struct feature kernel_features[] = {
.name = "private_reservations",
.required_version = "2.6.27-rc1",
+ .name = "noreserve_safe",
+ .required_version = "2.6.35",
+ }
static void debug_kernel_version(void)