public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alan Jenkins <sourcejedi.lkml@googlemail.com>
Cc: wu Jianfeng <stormplayer@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: select system call's implementation may have some bug, need your  help and confirm !!!
Date: Fri, 09 Oct 2009 11:20:38 +0200	[thread overview]
Message-ID: <1255080038.8802.1.camel@laptop> (raw)
In-Reply-To: <9b2b86520910090052n267f94ebj7619b6c5b94b3539@mail.gmail.com>

On Fri, 2009-10-09 at 08:52 +0100, Alan Jenkins wrote:
> On 10/9/09, wu Jianfeng <stormplayer@gmail.com> wrote:
> > A process may sleep for ever when he call select system call.
> > In detail, if the process was scheduled out just at the point it set
> > its state to TASK_INTERRUPTIBLE.
> >

> > set_current_state(TASK_INTERRUPTIBLE);
> > ## here set the process state TASK_INTERRUPTIBLE
> >
> >  ## if  the process was scheduled out here, then the process will
> > never can be waked up, because it has not been attached to any file 's
> > wait queue.
> 
> I'm not sure about that, but if you look at the current code (e.g. in
> linus' git tree) you will see this code has been changed.  Now
> set_current_state() is only called from poll_schedule_timeout(), and
> it won't suffer from the problem you suggested:
> 
> 
> int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
> 			  ktime_t *expires, unsigned long slack)
> {
> 	int rc = -EINTR;
> 
> 	set_current_state(state);
> 	if (!pwq->triggered)
> 		rc = schedule_hrtimeout_range(expires, slack, HRTIMER_MODE_ABS);
> 	__set_current_state(TASK_RUNNING);

It would still be liable to the problem suggested, if it were real,
which it is not, as Thomas pointed out.

The distinction is between getting preempted and calling schedule().


      reply	other threads:[~2009-10-09  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09  5:55 select system call's implementation may have some bug, need your help and confirm !!! wu Jianfeng
2009-10-09  7:52 ` Alan Jenkins
2009-10-09  9:20   ` Peter Zijlstra [this message]

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=1255080038.8802.1.camel@laptop \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sourcejedi.lkml@googlemail.com \
    --cc=stormplayer@gmail.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