Skip to contentSkip to conversation

change of behavior for madvise in 3.9-rc1

DISCUSSION CAI Qian 3 participants 4 messages Mar 7, 2013 – Mar 8, 2013 1 message not in the archive Memory management

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

CAI Qian

author
#1 lore raw

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, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 13 lines · 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
Quoted 6 lines

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, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 21 lines · Shaohua Li
Quoted 13 lines · 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
Quoted 6 lines

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
Quoted 2 lines

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, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#4 lore raw

----- Original Message -----

Quoted 43 lines

From: "Hugh Dickins" <[email protected]>
To: "Shaohua Li" <[email protected]>
Cc: "CAI Qian" <[email protected]>, "linux-mm" <[email protected]>, "linux-kernel" <[email protected]>, "Rik van Riel" <[email protected]>, "Sasha Levin" <[email protected]>, "Andrew Morton" <[email protected]>, "Linus Torvalds" <[email protected]>
Sent: Friday, March 8, 2013 2:49:48 AM
Subject: Re: change of behavior for madvise in 3.9-rc1

Quoted 30 lines · Shaohua Li
Quoted 18 lines · 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

Quoted 10 lines
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
Quoted 3 lines

I thought this is expected behavior. madvise(MADV_WILLNEED) to anonymous memory
doesn't return -EBADF now, as now we support swap prefretch.

Quoted 8 lines

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.

Quoted 3 lines

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>