Discussion:
change of behavior for madvise in 3.9-rc1
(too old to reply)
CAI Qian
2013-03-07 04:10:02 UTC
Bisecting indicated that this commit,
1998cc048901109a29924380b8e91bc049b32951
mm: make madvise(MADV_WILLNEED) support swap file prefetch

Caused an LTP test failure,
http://goo.gl/1FVPy

madvise02 1 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 2 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 3 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 4 TPASS : failed as expected: TEST_ERRNO=ENOMEM(12): Cannot allocate memory
madvise02 5 TFAIL : madvise succeeded unexpectedly

While it passed without the above commit
madvise02 1 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 2 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 3 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 4 TPASS : failed as expected: TEST_ERRNO=ENOMEM(12): Cannot allocate memory
madvise02 5 TPASS : failed as expected: TEST_ERRNO=EBADF(9): Bad file descriptor

CAI Qian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Shaohua Li
2013-03-07 04:40:02 UTC
Post by CAI Qian
Bisecting indicated that this commit,
1998cc048901109a29924380b8e91bc049b32951
mm: make madvise(MADV_WILLNEED) support swap file prefetch
Caused an LTP test failure,
http://goo.gl/1FVPy
madvise02 1 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 2 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 3 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 4 TPASS : failed as expected: TEST_ERRNO=ENOMEM(12): Cannot allocate memory
madvise02 5 TFAIL : madvise succeeded unexpectedly
While it passed without the above commit
madvise02 1 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 2 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 3 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 4 TPASS : failed as expected: TEST_ERRNO=ENOMEM(12): Cannot allocate memory
madvise02 5 TPASS : failed as expected: TEST_ERRNO=EBADF(9): Bad file descriptor
I thought this is expected behavior. madvise(MADV_WILLNEED) to anonymous memory
doesn't return -EBADF now, as now we support swap prefretch.

Thanks,
Shaohua
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Hugh Dickins
2013-03-07 19:00:01 UTC
Post by Shaohua Li
Post by CAI Qian
Bisecting indicated that this commit,
1998cc048901109a29924380b8e91bc049b32951
mm: make madvise(MADV_WILLNEED) support swap file prefetch
Caused an LTP test failure,
http://goo.gl/1FVPy
madvise02 1 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 2 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 3 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 4 TPASS : failed as expected: TEST_ERRNO=ENOMEM(12): Cannot allocate memory
madvise02 5 TFAIL : madvise succeeded unexpectedly
While it passed without the above commit
madvise02 1 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 2 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 3 TPASS : failed as expected: TEST_ERRNO=EINVAL(22): Invalid argument
madvise02 4 TPASS : failed as expected: TEST_ERRNO=ENOMEM(12): Cannot allocate memory
madvise02 5 TPASS : failed as expected: TEST_ERRNO=EBADF(9): Bad file descriptor
I thought this is expected behavior. madvise(MADV_WILLNEED) to anonymous memory
doesn't return -EBADF now, as now we support swap prefretch.
I agree with Shaohua: although the kernel strives for back-compatibility
with userspace, I don't think that goes so far as to tell an arbitrary LTP
test that it has failed, once the kernel has been enhanced to support new
functionality. We could never add or extend system calls if that were so.

Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
CAI Qian
2013-03-08 02:10:01 UTC
----- Original Message -----
Sent: Friday, March 8, 2013 2:49:48 AM
Subject: Re: change of behavior for madvise in 3.9-rc1
Post by Shaohua Li
Post by CAI Qian
Bisecting indicated that this commit,
1998cc048901109a29924380b8e91bc049b32951
mm: make madvise(MADV_WILLNEED) support swap file prefetch
Caused an LTP test failure,
http://goo.gl/1FVPy
TEST_ERRNO=EINVAL(22): Invalid argument
TEST_ERRNO=EINVAL(22): Invalid argument
TEST_ERRNO=EINVAL(22): Invalid argument
TEST_ERRNO=ENOMEM(12): Cannot allocate memory
madvise02 5 TFAIL : madvise succeeded unexpectedly
While it passed without the above commit
TEST_ERRNO=EINVAL(22): Invalid argument
TEST_ERRNO=EINVAL(22): Invalid argument
TEST_ERRNO=EINVAL(22): Invalid argument
TEST_ERRNO=ENOMEM(12): Cannot allocate memory
TEST_ERRNO=EBADF(9): Bad file descriptor
I thought this is expected behavior. madvise(MADV_WILLNEED) to anonymous memory
doesn't return -EBADF now, as now we support swap prefretch.
I agree with Shaohua: although the kernel strives for
back-compatibility
with userspace, I don't think that goes so far as to tell an
arbitrary LTP
test that it has failed, once the kernel has been enhanced to support new
functionality. We could never add or extend system calls if that were so.
Thanks for looking this. We will try to fix the LTP test instead.
Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/