madvise(2) actually returns with error EINVAL for MADV_REMOVE when used
for hugetlb vmas, not EOPNOTSUPP, and this has been the case since
MADV_REMOVE was introduced in commit f6b3ec238d12 ("madvise(MADV_REMOVE):
remove pages from tmpfs shm backing store").
Specify the exact behavior.
Signed-off-by: David Rientjes <[email protected]>
---
man2/madvise.2 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/man2/madvise.2 b/man2/madvise.2
index a3d93bb..00db39d 100644
--- a/man2/madvise.2
+++ b/man2/madvise.2
@@ -184,7 +184,9 @@ any filesystem which supports the
.BR FALLOC_FL_PUNCH_HOLE
mode also supports
.BR MADV_REMOVE .
-Other filesystems fail with the error
+Hugetlbfs will fail with the error
+.BR EINVAL
+and other filesystems fail with the error
.BR EOPNOTSUPP .
.TP
.BR MADV_DONTFORK " (since Linux 2.6.16)"
On 04/02/2015 11:21 PM, David Rientjes wrote:
> madvise(2) actually returns with error EINVAL for MADV_REMOVE when used
> for hugetlb vmas, not EOPNOTSUPP, and this has been the case since
> MADV_REMOVE was introduced in commit f6b3ec238d12 ("madvise(MADV_REMOVE):
> remove pages from tmpfs shm backing store").
Thanks David. Applied. I'd already fixed the appropriate piece in
the ERRORS list a while back, but missed that piece in the main text.
Cheers,
Michael
> Specify the exact behavior.
>
> Signed-off-by: David Rientjes <[email protected]>
> ---
> man2/madvise.2 | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/man2/madvise.2 b/man2/madvise.2
> index a3d93bb..00db39d 100644
> --- a/man2/madvise.2
> +++ b/man2/madvise.2
> @@ -184,7 +184,9 @@ any filesystem which supports the
> .BR FALLOC_FL_PUNCH_HOLE
> mode also supports
> .BR MADV_REMOVE .
> -Other filesystems fail with the error
> +Hugetlbfs will fail with the error
> +.BR EINVAL
> +and other filesystems fail with the error
> .BR EOPNOTSUPP .
> .TP
> .BR MADV_DONTFORK " (since Linux 2.6.16)"
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/