From: Nishanth Aravamudan <nacc@us.ibm.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] do all schedule_timeout() calls need to set state first?
Date: Mon, 19 Mar 2007 18:44:12 +0000 [thread overview]
Message-ID: <20070319184412.GF774@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0703191358530.13393@CPE00045a9c397f-CM001225dbafb6>
On 19.03.2007 [14:00:53 -0400], Robert P. J. Day wrote:
>
> based on what i've been reading, all calls to schedule_timeout()
> *must* first set the current process state to either
> TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE, is that correct?
Yes, but note that setting it directly before is not always necessary,
in particular when used with wait-queues. But, take a look at the
comment heading schedule_timeout():
* Make the current task sleep until @timeout jiffies have elapsed. The
* routine will return immediately unless the current task state has
* been set (see set_current_state()).
> since i was once again perusing the source tree and noticed the
> following in drivers/hwmon/ams/ams-i2c.c (line 93):
>
> while (remaining) {
> result = ams_i2c_read(AMS_COMMAND);
> if (result = 0 || result & 0x80)
> return 0;
>
> remaining = schedule_timeout(remaining);
> }
>
> it certainly *seems* that the state isn't being set here. is that an
> error? just curious.
Yes, it is. That is why we have schedule_timeout_interruptible() and
schedule_timeout_uninterruptible().
Thanks,
Nish
--
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2007-03-19 18:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-19 18:00 [KJ] do all schedule_timeout() calls need to set state first? Robert P. J. Day
2007-03-19 18:44 ` Nishanth Aravamudan [this message]
2007-03-19 19:47 ` Robert P. J. Day
2007-03-19 20:25 ` Nishanth Aravamudan
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=20070319184412.GF774@us.ibm.com \
--to=nacc@us.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.