Skip to contentSkip to conversation

sis900: don't use yield()

janitor Randy.Dunlap 2 participants 3 messages Apr 27, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: maximilian attems <[email protected]>

thanks to Felipe W Damasio hint rediffed.
patch is on top of linux-2.6.6-rc2

yield() removes process from active array into expired array, better just yield the CPU for a bit.
tested on my laptop with a sis900.

a++ maks

drivers/net/sis900.c +2 -1
Index: linux-266-rc2-kj1/drivers/net/sis900.c
===================================================================
@@ -600,7 +600,8 @@ static int __init sis900_mii_probe (stru
 
 	if(status & MII_STAT_LINK){
 		while (poll_bit) {
-			yield();
+			set_current_state(TASK_UNINTERRUPTIBLE);
+			schedule_timeout(HZ/100);
 
 			poll_bit ^= (mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS) & poll_bit);
 			if (time_after_eq(jiffies, timeout)) {

--

#1 lore raw
Quoted 16 lines · Randy.Dunlap

From: maximilian attems <[email protected]>

thanks to Felipe W Damasio hint rediffed.
patch is on top of linux-2.6.6-rc2

yield() removes process from active array into expired array, better just yield the CPU for a bit.
tested on my laptop with a sis900.

a++ maks

Index: linux-266-rc2-kj1/drivers/net/sis900.c
===================================================================

drivers/net/sis900.c static int __init sis900_mii_probe (stru · line 604

Quoted 6 lines
drivers/net/sis900.c +2 -1
@@ -600,7 +600,8 @@ static int __init sis900_mii_probe (stru
 
 	if(status & MII_STAT_LINK){
 		while (poll_bit) {
-			yield();
+			set_current_state(TASK_UNINTERRUPTIBLE);
+			schedule_timeout(HZ/100);

I would rather do schedule_timeout(1), as that's IMO closer to the intention...

Jeff

#2 lore raw

[janitor] sis900: don't use yield() (v2)

On Tue, 27 Apr 2004 14:03:37 -0400 Jeff Garzik wrote:

| I would rather do schedule_timeout(1), as that's IMO closer to the | intention...

From: maximilian attems <[email protected]>
Subject: [Kernel-janitors] [patch] use schedule_timeout() instead of yield()

	drivers/net/sis900.c

thanks to Felipe W Damasio hint rediffed.
patch is on top of linux-2.6.6-rc2

yield() removes process from active array into expired array, better just yield the CPU for a bit.
tested on my laptop with a sis900.

 drivers/net/sis900.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/sis900.c +2 -1
Index: linux-266-rc2-kj1/drivers/net/sis900.c
===================================================================
@@ -600,7 +600,8 @@ static int __init sis900_mii_probe (stru
 
 	if(status & MII_STAT_LINK){
 		while (poll_bit) {
-			yield();
+			set_current_state(TASK_UNINTERRUPTIBLE);
+			schedule_timeout(1);
 
 			poll_bit ^= (mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS) & poll_bit);
 			if (time_after_eq(jiffies, timeout)) {

--