mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[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 <jdike@addtoit.com> Cc: Hugh Dickins <hugh@veritas.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
676ff453e5
commit
b73781c866
3 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue