All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Aravamudan <nacc@us.ibm.com>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] Re: [PATCH 9/21] char/ipmi_si_intf: replace schedule_timeout()
Date: Mon, 17 Jan 2005 22:31:46 +0000	[thread overview]
Message-ID: <20050117223146.GL24698@us.ibm.com> (raw)
In-Reply-To: <41EC332A.8020603@mvista.com>

[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]

On Mon, Jan 17, 2005 at 03:53:12PM -0600, Corey Minyard wrote:
> On my previous question, to be more clear, why was this change 
> necessary?  In this particular instance, it doesn't matter how long it 
> sleeps, it just can't spin waiting for something to happen.  msleep() 
> spins, right?  That would be very bad in this code.  Even if not, the 
> particular timing is not important.

msleep() does not spin. The name itself is intended to indicate this. Delays
(mdelay(), udelay()) spin by looping tightly. Sleeps (msleep(), ssleep(), 
msleep_interruptible()) use schedule_timeout() to give up the CPU for a certain
amount of time.

Given this last comment, there is a clear benefit (IMO) to use actual time
units for sleeps (msleep() and co. use milliseconds or seconds) as opposed to
jiffy-relative units (as in schedule_timeout() where you are requesting a delay
in jiffies, which varies from arch to arch).

This becomes very important with dynamic HZ, for instance. Clearly if HZ
changes, then the delay caused by schedule_timeout(1) will change, which is not
necessarily desired and may be confusing the user. A time specified in real
time units will be adjusted with the change in HZ.

If it is not important how long the driver sleeps, then I believe msleep()
should be preferred in effectively all cases (depending on whether wait-queue
events or signals may be important early triggers, of course). Milliseconds
indicate a clear delay, independent of HZ's value. Jiffy delays have a clear
reliance on the value of HZ.

I am open to other suggestions, but I think these are good reasons. Another
basic one is that it will lead to consistency across the board. HZ is not a
measure of time, it should not be used as a measure of time. Instead,
milliseconds should be used and, when/if the facility has been added,
microseconds and nanoseconds.

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

  parent reply	other threads:[~2005-01-17 22:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-17 21:50 [KJ] Re: [PATCH 9/21] char/ipmi_si_intf: replace schedule_timeout() Corey Minyard
2005-01-17 21:53 ` Corey Minyard
2005-01-17 22:31 ` Nishanth Aravamudan [this message]
2005-01-17 22:41 ` Corey Minyard
2005-01-17 22:44 ` 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=20050117223146.GL24698@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.