[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DDB9C85B850785449757F9914A034FCB445092F8@G9W0766.americas.hpqcorp.net>
Date: Fri, 8 Jan 2016 00:02:18 +0000
From: "Seymour, Shane M" <shane.seymour@....com>
To: Nicholas Mc Guire <hofrat@...dl.org>, Willem Riede <osst@...de.org>
CC: "James E.J. Bottomley" <JBottomley@...n.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
"osst-users@...ts.sourceforge.net" <osst-users@...ts.sourceforge.net>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] [SCSI] osst: remove double conversion of timeout
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:
while (initial_delay)
initial_delay = schedule_timeout_uninterruptible(initial_delay);
We can change initial_delay since it's not used elsewhere in the function and if initial_delay is 0 we won't ever call schedule_timeout_uninterruptible in the while loop so there's no need to test if it's > 0 or not.
Thanks
Shane
Powered by blists - more mailing lists