Skip to contentSkip to conversation

scsi/osst: replace schedule_timeout()

PATCH Willem Riede 2 participants 2 messages Jul 27, 2004 Kernel janitors

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · Nishanth Aravamudan

I would appreciate any comments from the janitors list. This is one (of many) cases where I made a decision about replacing

set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(some_time);

Quoted 7 lines

with

msleep(jiffies_to_msecs(some_time));

msleep() is not exactly the same as the previous code, but I only did this replacement where I thought long delays were *desired*. If this is not the case here, then just disregard this patch.

While the exact delay for any schedule_timeout() in osst is usually not important, because there are outer loops that cause us to wait until the expected event takes place, I don't mind this change, with one exception:
I don't want to assume the value of HZ, so the values flagged below are not acceptable.

Willem Riede, osst maintainer.

Quoted 10 lines

Applys-to: 2.6.7

Description: Replace schedule_timeout() with msleep() to guarantee the task delays as desired.

drivers/scsi/osst.c +0 -0

[snip]

drivers/scsi/osst.c

Quoted 3 lines
drivers/scsi/osst.c +1 -2
-	    set_current_state(TASK_INTERRUPTIBLE);
-	    schedule_timeout(HZ / 10);
+	    msleep(100);
                  ^^^^^  must be HZ/10

[snip]

drivers/scsi/osst.c

Quoted 3 lines
drivers/scsi/osst.c +1 -2
-	    set_current_state(TASK_INTERRUPTIBLE);
-	    schedule_timeout(HZ / 10);
+	    msleep(100);
                  ^^^^^  must be HZ/10

[snip]

drivers/scsi/osst.c

Quoted 3 lines
drivers/scsi/osst.c +1 -2
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout (HZ / OSST_POLL_PER_SEC);
+		msleep(1000 / OSST_POLL_PER_SEC);

^^^^ must be HZ/OSST_POLL_PER_SEC
[snip]

drivers/scsi/osst.c

Quoted 2 lines
drivers/scsi/osst.c +1 -1
-						schedule_timeout(HZ / 10);
+						msleep(100);
                                                      ^^^^^ must be HZ/10

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw
Quoted 20 lines · Willem Riede
Quoted 6 lines · Nishanth Aravamudan

I would appreciate any comments from the janitors list. This is one (of many) cases where I made a decision about replacing

set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(some_time);

Quoted 7 lines

with

msleep(jiffies_to_msecs(some_time));

msleep() is not exactly the same as the previous code, but I only did this replacement where I thought long delays were *desired*. If this is not the case here, then just disregard this patch.

While the exact delay for any schedule_timeout() in osst is usually not important, because there are outer loops that cause us to wait until the expected event takes place, I don't mind this change, with one exception:
I don't want to assume the value of HZ, so the values flagged below are not acceptable.

<snip>

Quoted 4 lines

Review

Quoted 3 lines
(quoted diff) +1 -2
-	    set_current_state(TASK_INTERRUPTIBLE);
-	    schedule_timeout(HZ / 10);
+	    msleep(100);
                 ^^^^^  must be HZ/10

<snip>

These are not assumptions of any form. By the math:

(HZ / 10 jiffies) * (1 / HZ sec/jiffies) * (1000 msecs/sec) = 100 msecs

The reason for this is the invariant ratio of jiffies to seconds. So I don't think any changes need to be made to my patch.

Thanks, though, this is an important thing to be sure about.

-Nish

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors