Return value of __mm_populate
Subsystems (2)
Hi,
I was seeing the code of __mm_populate (in -next) and I've got a doubt about the return value. The function __mlock_posix_error_return should return a proper error for mlock, converting the return value from __get_user_pages. It checks for EFAULT and ENOMEM. Actually __get_user_pages could return, in addition, ERESTARTSYS and EHWPOISON. So it seems to me that we could return to user space not expected value. I can't see them on the man page. In addition we shouldn't ever return ERESTARTSYS to the user space but EINTR. According to the man pages maybe we should return EAGAIN in these cases. Am I missing something?
Thanks,
Marco
--
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>
Adding in cc: lkml
Il 13/04/2013 14:14, Marco Stornelli ha scritto:
Quoted 12 lines
Hi,
I was seeing the code of
__mm_populate(in -next) and I've got a doubt about the return value. The function__mlock_posix_error_returnshould return a proper error for mlock, converting the return value from__get_user_pages. It checks for EFAULT and ENOMEM. Actually__get_user_pagescould return, in addition, ERESTARTSYS and EHWPOISON. So it seems to me that we could return to user space not expected value. I can't see them on the man page. In addition we shouldn't ever return ERESTARTSYS to the user space but EINTR. According to the man pages maybe we should return EAGAIN in these cases. Am I missing something?
Quoted 3 lines
Thanks,
Marco
--
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>
Quoted 7 lines · Marco Stornelli
Hi,
I was seeing the code of
__mm_populate(in -next) and I've got a doubt about the return value. The function__mlock_posix_error_returnshould return a proper error for mlock, converting the return value from__get_user_pages. It checks for EFAULT and ENOMEM. Actually__get_user_pagescould return, in addition, ERESTARTSYS and EHWPOISON.
__get_user_pages doesn't return EHWPOISON if FOLL_HWPOISON is not specified. I'm not expert ERESTARTSYS. I understand correctly, ERESTARTSYS is only returned when signal received, and signal handling routine (e.g. do_signal) modify EIP and hidden ERESTARTSYS from userland generically.
Quoted 4 lines
So it seems to me that we could return to user space not expected value. I can't see them on the man page. In addition we shouldn't ever return ERESTARTSYS to the user space but EINTR. According to the man pages maybe we should return EAGAIN in these cases. Am I missing something?
Hi,
Il 14/04/2013 02:18, KOSAKI Motohiro ha scritto:
Quoted 9 lines
Quoted 7 lines · Marco Stornelli
Hi,
I was seeing the code of
__mm_populate(in -next) and I've got a doubt about the return value. The function__mlock_posix_error_returnshould return a proper error for mlock, converting the return value from__get_user_pages. It checks for EFAULT and ENOMEM. Actually__get_user_pagescould return, in addition, ERESTARTSYS and EHWPOISON.
Quoted 5 lines
__get_user_pagesdoesn't return EHWPOISON ifFOLL_HWPOISONis not specified. I'm not expert ERESTARTSYS. I understand correctly, ERESTARTSYS is only returned when signal received, and signal handling routine (e.g.do_signal) modify EIP and hidden ERESTARTSYS from userland generically.
Yep, you're right, the "magic" is inside the signal management. Thanks!!
Marco
--
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>