linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Return value of __mm_populate
       [not found] <51694C2A.4050906@gmail.com>
@ 2013-04-13 12:41 ` Marco
  2013-04-14  0:18 ` KOSAKI Motohiro
  1 sibling, 0 replies; 3+ messages in thread
From: Marco @ 2013-04-13 12:41 UTC (permalink / raw)
  To: linux-mm; +Cc: Linux Kernel

Adding in cc: lkml

Il 13/04/2013 14:14, Marco Stornelli ha scritto:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Return value of __mm_populate
       [not found] <51694C2A.4050906@gmail.com>
  2013-04-13 12:41 ` Return value of __mm_populate Marco
@ 2013-04-14  0:18 ` KOSAKI Motohiro
  2013-04-14  7:25   ` Marco Stornelli
  1 sibling, 1 reply; 3+ messages in thread
From: KOSAKI Motohiro @ 2013-04-14  0:18 UTC (permalink / raw)
  To: Marco Stornelli; +Cc: linux-mm, Linux FS Devel, kosaki.motohiro, lkml

(4/13/13 5:14 AM), Marco Stornelli wrote:
> 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. 

__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.


> 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?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Return value of __mm_populate
  2013-04-14  0:18 ` KOSAKI Motohiro
@ 2013-04-14  7:25   ` Marco Stornelli
  0 siblings, 0 replies; 3+ messages in thread
From: Marco Stornelli @ 2013-04-14  7:25 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: linux-mm, lkml

Hi,

Il 14/04/2013 02:18, KOSAKI Motohiro ha scritto:
> (4/13/13 5:14 AM), Marco Stornelli wrote:
>> 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.
>
> __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.
>

Yep, you're right, the "magic" is inside the signal management. Thanks!!

Marco

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-14  7:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <51694C2A.4050906@gmail.com>
2013-04-13 12:41 ` Return value of __mm_populate Marco
2013-04-14  0:18 ` KOSAKI Motohiro
2013-04-14  7:25   ` Marco Stornelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).