* [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout()
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
@ 2004-04-24 19:28 ` Gustavo Franco
2004-04-24 19:35 ` Gustavo Franco
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Gustavo Franco @ 2004-04-24 19:28 UTC (permalink / raw)
To: kernel-janitors
Hi list,
I guess that it's ok, please apply.
Thanks,
Gustavo Franco
--- drivers/net/sb1000.c.orig 2004-04-24 13:46:26.000000000 -0300
+++ drivers/net/sb1000.c 2004-04-24 13:47:01.000000000 -0300
@@ -271,7 +271,7 @@
timeout = jiffies + TimeOutJiffies;
while (a & 0x80 || a & 0x40) {
/* a little sleep */
- yield();
+ schedule_timeout(1);
a = inb(ioaddr[0] + 7);
if (time_after_eq(jiffies, timeout)) {
@@ -295,7 +295,7 @@
timeout = jiffies + TimeOutJiffies;
while (a & 0x80 || !(a & 0x40)) {
/* a little sleep */
- yield();
+ schedule_timeout(1);
a = inb(ioaddr[1] + 6);
if (time_after_eq(jiffies, timeout)) {
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout()
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
2004-04-24 19:28 ` Gustavo Franco
@ 2004-04-24 19:35 ` Gustavo Franco
2004-04-25 18:38 ` [Kernel-janitors] [PATCH] Replaces yield() with Domen Puncer
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Gustavo Franco @ 2004-04-24 19:35 UTC (permalink / raw)
To: kernel-janitors
Hi list,
I guess that it's ok, please apply.
Thanks,
Gustavo Franco
--- drivers/cdrom/sonycd535.c.orig 2004-04-24 13:46:28.000000000 -0300
+++ drivers/cdrom/sonycd535.c 2004-04-24 13:47:38.000000000 -0300
@@ -342,7 +342,7 @@
sony_sleep(void)
{
if (sony535_irq_used <= 0) { /* poll */
- yield();
+ schedule_timeout(1);
} else { /* Interrupt driven */
DEFINE_WAIT(wait);
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
2004-04-24 19:28 ` Gustavo Franco
2004-04-24 19:35 ` Gustavo Franco
@ 2004-04-25 18:38 ` Domen Puncer
2004-04-25 23:10 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Domen Puncer @ 2004-04-25 18:38 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]
On Sat, Apr 24, 2004 at 03:34:44PM -0300, Gustavo Franco wrote:
> Hi list,
>
> Following what i've said, i'm looking each yield() call to check if it
> needs to be
> replaced.I'll send two more patches today and a status message, if
> everything
> is ok, i'm planning to complete this task on the next week.
>
> Thanks,
> Gustavo Franco
>
> --- drivers/scsi/megaraid.c.orig 2004-04-24 13:54:26.000000000 -0300
> +++ drivers/scsi/megaraid.c 2004-04-24 13:54:36.000000000 -0300
> @@ -1691,7 +1691,7 @@
> for (counter = 0; counter < 10000; counter++) {
> if (!mbox->m_in.busy)
> return 0;
> - udelay(100); yield();
> + udelay(100); schedule_timeout(1);
This makes no sense to me.
schedule without set_current_state (also missing in other patches);
Why leave udelay?
How about something like:
for (counter = 0; counter < 1000; counter++) {
if (!mbox->m_in.busy)
return 0;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
counter < 1000 test is on purpose, to get >= 1 second, not 10.
Comments?
Domen
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout()
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (2 preceding siblings ...)
2004-04-25 18:38 ` [Kernel-janitors] [PATCH] Replaces yield() with Domen Puncer
@ 2004-04-25 23:10 ` Gustavo Franco
2004-04-25 23:25 ` [Kernel-janitors] [PATCH] Replaces yield() with Randy.Dunlap
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Gustavo Franco @ 2004-04-25 23:10 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]
Domen Puncer wrote:
>On Sat, Apr 24, 2004 at 03:34:44PM -0300, Gustavo Franco wrote:
>
>
>>Hi list,
>>
>>Following what i've said, i'm looking each yield() call to check if it
>>needs to be
>>replaced.I'll send two more patches today and a status message, if
>>everything
>>is ok, i'm planning to complete this task on the next week.
>>
>>Thanks,
>>Gustavo Franco
>>
>>--- drivers/scsi/megaraid.c.orig 2004-04-24 13:54:26.000000000 -0300
>>+++ drivers/scsi/megaraid.c 2004-04-24 13:54:36.000000000 -0300
>>@@ -1691,7 +1691,7 @@
>> for (counter = 0; counter < 10000; counter++) {
>> if (!mbox->m_in.busy)
>> return 0;
>>- udelay(100); yield();
>>+ udelay(100); schedule_timeout(1);
>>
>>
>
>This makes no sense to me.
>schedule without set_current_state (also missing in other patches);
>Why leave udelay?
>
>How about something like:
> for (counter = 0; counter < 1000; counter++) {
> if (!mbox->m_in.busy)
> return 0;
> set_current_state(TASK_INTERRUPTIBLE);
> schedule_timeout(1);
>
>counter < 1000 test is on purpose, to get >= 1 second, not 10.
>
>
>
Hi Domen,
My failure, i haven't checked if the set_current_state() was really
needed.I'm working
on the TODO item "Calling yield() Considered Harmful" written by Matthew
Wilcox.Since
set_current_state() isn't cited by him and wasn't by Randy, i'll wait
until Randy ask for rediffied
patches.Randy?
Thanks,
Gustavo Franco
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (3 preceding siblings ...)
2004-04-25 23:10 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
@ 2004-04-25 23:25 ` Randy.Dunlap
2004-04-26 0:47 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Randy.Dunlap @ 2004-04-25 23:25 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]
On Sun, 25 Apr 2004 20:10:41 -0300 Gustavo Franco <stratus@acm.org> wrote:
| Domen Puncer wrote:
|
| >On Sat, Apr 24, 2004 at 03:34:44PM -0300, Gustavo Franco wrote:
| >
| >
| >>Hi list,
| >>
| >>Following what i've said, i'm looking each yield() call to check if it
| >>needs to be
| >>replaced.I'll send two more patches today and a status message, if
| >>everything
| >>is ok, i'm planning to complete this task on the next week.
| >>
| >>Thanks,
| >>Gustavo Franco
| >>
| >>--- drivers/scsi/megaraid.c.orig 2004-04-24 13:54:26.000000000 -0300
| >>+++ drivers/scsi/megaraid.c 2004-04-24 13:54:36.000000000 -0300
| >>@@ -1691,7 +1691,7 @@
| >> for (counter = 0; counter < 10000; counter++) {
| >> if (!mbox->m_in.busy)
| >> return 0;
| >>- udelay(100); yield();
| >>+ udelay(100); schedule_timeout(1);
| >>
| >>
| >
| >This makes no sense to me.
| >schedule without set_current_state (also missing in other patches);
| >Why leave udelay?
| >
| >How about something like:
| > for (counter = 0; counter < 1000; counter++) {
| > if (!mbox->m_in.busy)
| > return 0;
| > set_current_state(TASK_INTERRUPTIBLE);
| > schedule_timeout(1);
| >
| >counter < 1000 test is on purpose, to get >= 1 second, not 10.
| >
| >
| >
| Hi Domen,
|
| My failure, i haven't checked if the set_current_state() was really
| needed.I'm working
| on the TODO item "Calling yield() Considered Harmful" written by Matthew
| Wilcox.Since
| set_current_state() isn't cited by him and wasn't by Randy, i'll wait
| until Randy ask for rediffied
| patches.Randy?
Yes, looks like Domen is correct. He's right about the source code comment.
Then I looked at 25 source files that use schedule_timeout() and all of
them set current state first.
I'll update the TODO list with this info.
Thanks, all.
--
~Randy
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout()
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (4 preceding siblings ...)
2004-04-25 23:25 ` [Kernel-janitors] [PATCH] Replaces yield() with Randy.Dunlap
@ 2004-04-26 0:47 ` Gustavo Franco
2004-04-26 1:29 ` [Kernel-janitors] [PATCH] Replaces yield() with Randy.Dunlap
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Gustavo Franco @ 2004-04-26 0:47 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 694 bytes --]
Randy.Dunlap wrote:
>| Hi Domen,
>|
>| My failure, i haven't checked if the set_current_state() was really
>| needed.I'm working
>| on the TODO item "Calling yield() Considered Harmful" written by Matthew
>| Wilcox.Since
>| set_current_state() isn't cited by him and wasn't by Randy, i'll wait
>| until Randy ask for rediffied
>| patches.Randy?
>
>Yes, looks like Domen is correct. He's right about the source code comment.
>Then I looked at 25 source files that use schedule_timeout() and all of
>them set current state first.
>
>I'll update the TODO list with this info.
>
>
>
Randy,
So, do you need "rediffied" patches with set_current_state() calls, right?
Thanks,
Gustavo Franco
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (5 preceding siblings ...)
2004-04-26 0:47 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
@ 2004-04-26 1:29 ` Randy.Dunlap
2004-04-26 12:23 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Felipe W Damasio
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Randy.Dunlap @ 2004-04-26 1:29 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]
On Sun, 25 Apr 2004 21:47:33 -0300 Gustavo Franco <stratus@acm.org> wrote:
| Randy.Dunlap wrote:
|
| >| Hi Domen,
| >|
| >| My failure, i haven't checked if the set_current_state() was really
| >| needed.I'm working
| >| on the TODO item "Calling yield() Considered Harmful" written by Matthew
| >| Wilcox.Since
| >| set_current_state() isn't cited by him and wasn't by Randy, i'll wait
| >| until Randy ask for rediffied
| >| patches.Randy?
| >
| >Yes, looks like Domen is correct. He's right about the source code comment.
| >Then I looked at 25 source files that use schedule_timeout() and all of
| >them set current state first.
| >
| >I'll update the TODO list with this info.
| >
| >
| >
| Randy,
|
| So, do you need "rediffied" patches with set_current_state() calls, right?
Oh, yes, sorry I wasn't clear about that.
Thanks,
--
~Randy
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout()
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (6 preceding siblings ...)
2004-04-26 1:29 ` [Kernel-janitors] [PATCH] Replaces yield() with Randy.Dunlap
@ 2004-04-26 12:23 ` Felipe W Damasio
2004-04-28 21:03 ` [Kernel-janitors] [PATCH] Replaces yield() with maximilian attems
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Felipe W Damasio @ 2004-04-26 12:23 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 722 bytes --]
Hi,
Gustavo Franco wrote:
> I guess that it's ok, please apply.
>
> Thanks,
> Gustavo Franco
>
>
> --- drivers/cdrom/sonycd535.c.orig 2004-04-24 13:46:28.000000000 -0300
> +++ drivers/cdrom/sonycd535.c 2004-04-24 13:47:38.000000000 -0300
> @@ -342,7 +342,7 @@
> sony_sleep(void)
> {
> if (sony535_irq_used <= 0) { /* poll */
> - yield();
> + schedule_timeout(1);
I don't think it's that cut-and-dry...shouldn't you use something
relevant to HZ on this? Please see the patch maximilian sent on sis900
net driver.
Also, don't forget to use TASK_INTERRUPTITBLE (with a set_current_state
that uses a memory barrier) before using schedule_timeout, please.
Cheers,
Felipe
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (7 preceding siblings ...)
2004-04-26 12:23 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Felipe W Damasio
@ 2004-04-28 21:03 ` maximilian attems
2004-04-28 21:07 ` Randy.Dunlap
2004-04-28 21:13 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Felipe W Damasio
10 siblings, 0 replies; 12+ messages in thread
From: maximilian attems @ 2004-04-28 21:03 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 676 bytes --]
hello,
On Mon, 26 Apr 2004, Felipe W Damasio wrote:
> Gustavo Franco wrote:
> >--- drivers/cdrom/sonycd535.c.orig 2004-04-24 13:46:28.000000000 -0300
> >+++ drivers/cdrom/sonycd535.c 2004-04-24 13:47:38.000000000 -0300
> >@@ -342,7 +342,7 @@
> >sony_sleep(void)
> >{
> > if (sony535_irq_used <= 0) { /* poll */
> >- yield();
> >+ schedule_timeout(1);
>
> I don't think it's that cut-and-dry...shouldn't you use something
> relevant to HZ on this? Please see the patch maximilian sent on sis900
> net driver.
jeff garzik prefers schedule_timeout(1) in the case of the sis900,
"that's IMO closer to the intention.."
regards maks
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (8 preceding siblings ...)
2004-04-28 21:03 ` [Kernel-janitors] [PATCH] Replaces yield() with maximilian attems
@ 2004-04-28 21:07 ` Randy.Dunlap
2004-04-28 21:13 ` [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Felipe W Damasio
10 siblings, 0 replies; 12+ messages in thread
From: Randy.Dunlap @ 2004-04-28 21:07 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 836 bytes --]
On Wed, 28 Apr 2004 23:03:56 +0200 maximilian attems wrote:
| hello,
|
| On Mon, 26 Apr 2004, Felipe W Damasio wrote:
|
| > Gustavo Franco wrote:
| > >--- drivers/cdrom/sonycd535.c.orig 2004-04-24 13:46:28.000000000 -0300
| > >+++ drivers/cdrom/sonycd535.c 2004-04-24 13:47:38.000000000 -0300
| > >@@ -342,7 +342,7 @@
| > >sony_sleep(void)
| > >{
| > > if (sony535_irq_used <= 0) { /* poll */
| > >- yield();
| > >+ schedule_timeout(1);
| >
| > I don't think it's that cut-and-dry...shouldn't you use something
| > relevant to HZ on this? Please see the patch maximilian sent on sis900
| > net driver.
|
| jeff garzik prefers schedule_timeout(1) in the case of the sis900,
| "that's IMO closer to the intention.."
Yes, and I've already sent an updated sis900.c patch to Jeff.
--
~Randy
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread* Re: [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout()
2004-04-24 18:34 [Kernel-janitors] [PATCH] Replaces yield() with schedule_timeout() Gustavo Franco
` (9 preceding siblings ...)
2004-04-28 21:07 ` Randy.Dunlap
@ 2004-04-28 21:13 ` Felipe W Damasio
10 siblings, 0 replies; 12+ messages in thread
From: Felipe W Damasio @ 2004-04-28 21:13 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
maximilian attems wrote:
> jeff garzik prefers schedule_timeout(1) in the case of the sis900,
> "that's IMO closer to the intention.."
Sounds fair, since he's the one whom chooses which patches get in ;)
Anyway, we still need set_current_state before calling schedule_timeout.
Cheers,
Felipe
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 12+ messages in thread