lkml.org 
[lkml]   [2016]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] [SCSI] osst: remove double conversion of timeout
Date
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

\
 
 \ /
  Last update: 2016-01-08 01:21    [W:0.069 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site