git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vserver 1.9.5.x5
[linux-2.6.git]
/
mm
/
madvise.c
diff --git
a/mm/madvise.c
b/mm/madvise.c
index
0439c56
..
944b5e5
100644
(file)
--- a/
mm/madvise.c
+++ b/
mm/madvise.c
@@
-7,7
+7,8
@@
#include <linux/mman.h>
#include <linux/pagemap.h>
#include <linux/mman.h>
#include <linux/pagemap.h>
-
+#include <linux/syscalls.h>
+#include <linux/hugetlb.h>
/*
* We can potentially split a vm area into separate
/*
* We can potentially split a vm area into separate
@@
-17,18
+18,18
@@
static long madvise_behavior(struct vm_area_struct * vma, unsigned long start,
unsigned long end, int behavior)
{
struct mm_struct * mm = vma->vm_mm;
unsigned long end, int behavior)
{
struct mm_struct * mm = vma->vm_mm;
- int error;
+ int error
= 0
;
if (start != vma->vm_start) {
error = split_vma(mm, vma, start, 1);
if (error)
if (start != vma->vm_start) {
error = split_vma(mm, vma, start, 1);
if (error)
-
return -EAGAIN
;
+
goto out
;
}
if (end != vma->vm_end) {
error = split_vma(mm, vma, end, 0);
if (error)
}
if (end != vma->vm_end) {
error = split_vma(mm, vma, end, 0);
if (error)
-
return -EAGAIN
;
+
goto out
;
}
/*
}
/*
@@
-47,7
+48,10
@@
static long madvise_behavior(struct vm_area_struct * vma, unsigned long start,
break;
}
break;
}
- return 0;
+out:
+ if (error == -ENOMEM)
+ error = -EAGAIN;
+ return error;
}
/*
}
/*
@@
-93,7
+97,7
@@
static long madvise_willneed(struct vm_area_struct * vma,
static long madvise_dontneed(struct vm_area_struct * vma,
unsigned long start, unsigned long end)
{
static long madvise_dontneed(struct vm_area_struct * vma,
unsigned long start, unsigned long end)
{
- if (
vma->vm_flags & VM_LOCKED
)
+ if (
(vma->vm_flags & VM_LOCKED) || is_vm_hugetlb_page(vma)
)
return -EINVAL;
if (unlikely(vma->vm_flags & VM_NONLINEAR)) {
return -EINVAL;
if (unlikely(vma->vm_flags & VM_NONLINEAR)) {