From: Nishanth Aravamudan <nacc@us.ibm.com>
To: kernel-janitors@vger.kernel.org
Subject: [Kernel-janitors] Re: [PATCH] usb/auerswald: replace
Date: Wed, 28 Jul 2004 18:33:59 +0000 [thread overview]
Message-ID: <20040728183359.GO1935@us.ibm.com> (raw)
In-Reply-To: <200407282023.23796.wolfgang@iksw-muees.de>
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]
On Wed, Jul 28, 2004 at 08:23:23PM +0200, Wolfgang M?es wrote:
> Hello Nishanth,
>
> On Wednesday 28 July 2004 01:12, Nishanth Aravamudan wrote:
> > I would appreciate any comments from the janitors list.
> >
> > Applys-to: 2.6.7
> >
> > Description: Use msleep() instead of schedule_timeout() to
> > guarantee the task delays for the desired time.
> >
> > Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> >
> >
> > --- linux-vanilla/drivers/usb/misc/auerswald.c 2004-06-16
>
> I am the author of this driver.
>
> Can you give me the rationale of the proposed change?
> In what sense is msleep() better/other than schedule_timeout?
Certainly. Some of this is going to be a repetition from previous posts
to the list, but oh well.
In this particular case, the rationale is quite simple. There are
certain situations -- the details of which I will have to defer to Greg
Kroah-Hartman for -- in which a code snippet such as:
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(some_time);
will not delay as desired, i.e. the task resumes *before* some_time has
elapsed, instead of after. To prevent this condition from occuring,
msleep() wraps the schedule_timeout() in a while-loop on the timeout
value. Thus, as long as the timeout retains a positive value the task
gives the CPU back up and delays again. And once the timeout is 0, the
task is resumed. For the details, I recommend consulting the source
(kernel/timer.c).
Also, and this is less technical, but msleep() allows code to be written
in terms of milliseconds instead of jiffies, which is far clearer to a
person, IMO. All rounding issues are taken care of by msleep() as well,
as it uses msecs_to_jiffies() to calculate the correct delay value for
schedule_timeout().
Does that help?
Thanks,
Nish
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2004-07-28 18:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-28 18:23 [Kernel-janitors] Re: [PATCH] usb/auerswald: replace Wolfgang Mües
2004-07-28 18:33 ` Nishanth Aravamudan [this message]
2004-08-02 21:26 ` Greg KH
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=20040728183359.GO1935@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.