From b73781c866f671ff5a84d7c840510b43e8731d13 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Tue, 18 Apr 2006 22:20:24 -0700 Subject: [PATCH] uml: MADV_REMOVE fixes MADV_REMOVE fixes - change the test mapping to be MAP_SHARED instead of MAP_PRIVATE, as MADV_REMOVE on MAP_PRIVATE maps won't work. Also, use the kernel's definition of MADV_REMOVE instead of hardcoding it if there isn't a libc definition. Signed-off-by: Jeff Dike Cc: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/os-Linux/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/um/os-Linux') diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c index 8176b0b5204..2064e8400d9 100644 --- a/arch/um/os-Linux/process.c +++ b/arch/um/os-Linux/process.c @@ -190,7 +190,7 @@ int os_unmap_memory(void *addr, int len) } #ifndef MADV_REMOVE -#define MADV_REMOVE 0x5 /* remove these pages & resources */ +#define MADV_REMOVE KERNEL_MADV_REMOVE #endif int os_drop_memory(void *addr, int length) @@ -216,7 +216,7 @@ int can_drop_memory(void) } addr = mmap64(NULL, UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE, fd, 0); + MAP_SHARED, fd, 0); if(addr == MAP_FAILED){ printk("Mapping test memory file failed, err = %d\n", -errno); return 0; -- cgit v1.2.3