From: Nicholas Mc Guire <der.herr@hofr.at>
To: "Seymour, Shane M" <shane.seymour@hpe.com>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
Willem Riede <osst@riede.org>,
"James E.J. Bottomley" <JBottomley@odin.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"osst-users@lists.sourceforge.net"
<osst-users@lists.sourceforge.net>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [SCSI] osst: remove double conversion of timeout
Date: Fri, 8 Jan 2016 07:31:55 +0000 [thread overview]
Message-ID: <20160108073155.GA16584@osadl.at> (raw)
In-Reply-To: <DDB9C85B850785449757F9914A034FCB445092F8@G9W0766.americas.hpqcorp.net>
On Fri, Jan 08, 2016 at 12:02:18AM +0000, Seymour, Shane M wrote:
> Hi Nicholas,
>
> > - msleep(jiffies_to_msecs(initial_delay));
> > + schedule_timeout_uninterruptible(initial_delay);
>
> The code to msleep looks like this:
>
> /**
> * msleep - sleep safely even with waitqueue interruptions
> * @msecs: Time in milliseconds to sleep for
> */
> void msleep(unsigned int msecs)
> {
> unsigned long timeout = msecs_to_jiffies(msecs) + 1;
>
> while (timeout)
> timeout = schedule_timeout_uninterruptible(timeout);
> }
>
> So msleep will wait for the requested amount of time to pass even if woken early but your change may not. To make it equivalent you would need to borrow code from msleep and remove the "if (initial_delay > 0)" and just have:
If I understand the documentation to
schedule_timeout() correctly then this is not the
case:
<snip>
/**
* schedule_timeout - sleep until timeout
* @timeout: timeout value in jiffies
*
* 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()).
*
* You can set the task state as follows -
*
* %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to
* pass before the routine returns. The routine will return 0
...
<snip>
and schedule_timeout_uninterruptiple does that
signed long __sched schedule_timeout_uninterruptible(signed long timeout)
{
__set_current_state(TASK_UNINTERRUPTIBLE);
return schedule_timeout(timeout);
}
so my understanding is that this will not return early and should thus
be equivalent to the behavior of msleep.
did I overlook something here ?
thx!
hofrat
next prev parent reply other threads:[~2016-01-08 7:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 20:10 Nicholas Mc Guire
2016-01-08 0:02 ` Seymour, Shane M
2016-01-08 7:31 ` Nicholas Mc Guire [this message]
2016-01-11 0:54 ` Seymour, Shane M
2016-01-12 15:10 ` Nicholas Mc Guire
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=20160108073155.GA16584@osadl.at \
--to=der.herr@hofr.at \
--cc=JBottomley@odin.com \
--cc=hofrat@osadl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=osst-users@lists.sourceforge.net \
--cc=osst@riede.org \
--cc=shane.seymour@hpe.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
all inboxes | Powered by JetHome®