From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Manfred Spraul <manfred@colorfullife.com>,
linux-kernel@vger.kernel.org, Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH] Use ERESTARTNOHAND if poll() is interrupted by a signal
Date: Tue, 31 Jul 2007 04:18:47 +0400 [thread overview]
Message-ID: <20070731001847.GA623@tv-sign.ru> (raw)
In-Reply-To: <20070731001117.GA583@tv-sign.ru>
On 07/31, Oleg Nesterov wrote:
>
> > Manfred Spraul <manfred@colorfullife.com> wrote:
> >
> > > poll() returns -EINTR if a signal is pending.
> > > EINTR is a bad choice: it means that poll returns to user space if the
> > > task is stopped by SIGSTOP/SIGCONT or by the freezer.
> > > select() and ppoll() both use ERESTARTNOHAND, this avoids a return to
> > > user space for signals that are handled by the kernel.
> > >
> > > The patch switches poll() to ERESTARTNOHAND.
> > > Tested with FC6. Patch against 2.6.23-rc1-mm1.
> >
> > > --- 2.6/fs/select.c 2007-07-28 20:31:51.000000000 +0200
> > > +++ build-2.6/fs/select.c 2007-07-28 21:21:52.000000000 +0200
> > > @@ -621,7 +621,7 @@ static int do_poll(unsigned int nfds, s
> > > if (!count) {
> > > count = wait->error;
> > > if (signal_pending(current))
> > > - count = -EINTR;
> > > + count = -ERESTARTNOHAND;
>
> I am not sure. This means we restart sys_poll() with the same timeout
> if there is no pending signal. I think we need ERESTART_RESTARTBLOCK
> logic.
Forgot to mention, sys_select() can use ERESTARTNOHAND because it
modifies "struct timeval __user *tvp" before return, but sys_poll()
gets timeout_msecs by value.
Oleg.
next prev parent reply other threads:[~2007-07-31 0:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-29 17:05 Manfred Spraul
2007-07-30 23:35 ` Andrew Morton
2007-07-30 23:59 ` Chris Wright
2007-07-31 0:11 ` Oleg Nesterov
2007-07-31 0:18 ` Oleg Nesterov [this message]
2007-07-31 17:36 ` Chris Wright
2007-07-31 20:31 ` Manfred Spraul
2007-07-31 21:08 ` Oleg Nesterov
2007-08-04 6:39 ` [PATCH] Use ERESTART_RESTARTBLOCK if poll() is interrupted by a signal (was: Re: [PATCH] Use ERESTARTNOHAND if poll() is interrupted by a signal) Chris Wright
2007-08-04 11:07 ` Oleg Nesterov
2007-08-15 22:27 ` [PATCH take2] Use ERESTART_RESTARTBLOCK if poll() is interrupted by a signal Chris Wright
2007-08-16 15:51 ` Oleg Nesterov
2007-08-28 9:11 ` [PATCH] Use ERESTARTNOHAND " Roland McGrath
2007-07-30 23:56 ` Chris Wright
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070731001847.GA623@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=roland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome