Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1304049

RE: [PATCH] [SCSI] osst: remove double conversion of timeout

From "Seymour, Shane M" <shane.seymour@hpe.com>
Newsgroups linux.kernel
Subject RE: [PATCH] [SCSI] osst: remove double conversion of timeout
Date 2016-01-08 01:10 +0100
Message-ID <qOsMX-77N-37@gated-at.bofh.it> (permalink)
References <qOpcm-4F9-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] [SCSI] osst: remove double conversion of timeout Nicholas Mc Guire <hofrat@osadl.org> - 2016-01-07 21:20 +0100
  RE: [PATCH] [SCSI] osst: remove double conversion of timeout "Seymour, Shane M" <shane.seymour@hpe.com> - 2016-01-08 01:10 +0100
    Re: [PATCH] [SCSI] osst: remove double conversion of timeout Nicholas Mc Guire <der.herr@hofr.at> - 2016-01-08 08:40 +0100
      RE: [PATCH] [SCSI] osst: remove double conversion of timeout "Seymour, Shane M" <shane.seymour@hpe.com> - 2016-01-11 02:00 +0100
        Re: [PATCH] [SCSI] osst: remove double conversion of timeout Nicholas Mc Guire <der.herr@hofr.at> - 2016-01-12 16:20 +0100

csiph-web