ipconfig schedule fix
Subsystems (3)
PATCH 1/1 ipconfig schedule fix
Hi,
This simple patch makes the DHCP/BOOTP/RARP code sleep with schedule_timeout() instead of hogging the cpu with cpu_relax() in a loop. This comes handy when a guest kernel is booted inside QEMU. Without the patch, the host operating system will consume cpu time busy waiting.
Thanks,
/ magnus
net/ipv4/ipconfig.c +6 -9
@@ -1102,8 +1102,8 @@ jiff = jiffies + (d->next ?CONF_INTER_TIMEOUT : timeout);while (time_before (jiffies, jiff) && !ic_got_reply) { -barrier (); -cpu_relax (); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (1 ); }#ifdef IPCONFIG_DHCP /* DHCP isn't done until we get a DHCPACK. */
@@ -1245,7 +1245,6 @@static int __init ip_auto_config (void ) { -unsigned long jiff;u32 addr;#ifdef CONFIG_PROC_FS
@@ -1260,18 +1259,16 @@ try_try_again:#endif /* Give hardware a chance to settle */ - jiff = jiffies +CONF_PRE_OPEN ; -while (time_before (jiffies, jiff)) -cpu_relax (); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (CONF_PRE_OPEN );/* Setup all network devices */ if (ic_open_devs () <0 )return -1 ;/* Give drivers a chance to settle */ - jiff = jiffies +CONF_POST_OPEN ; -while (time_before (jiffies, jiff)) -cpu_relax (); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_timeout (CONF_POST_OPEN );/* * If the config information is insufficient (e.g., our IP address or
David S. Miller
maintainerQuoted 5 lines · On Tue, 23 Nov 2004 23:50:35 +0100 Magnus Damm <[email protected]> wrote:
This simple patch makes the DHCP/BOOTP/RARP code sleep with
schedule_timeout()instead of hogging the cpu withcpu_relax()in a loop. This comes handy when a guest kernel is booted inside QEMU. Without the patch, the host operating system will consume cpu time busy waiting.
There are two similar loops involving CONF_PRE_OPEN and CONF_POST_OPEN, you may wish to hit those while you're at it.
Quoted 5 lines · David S. Miller
On Tue, 23 Nov 2004 23:50:35 +0100
Magnus Damm <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
This simple patch makes the DHCP/BOOTP/RARP code sleep with
schedule_timeout()instead of hogging the cpu withcpu_relax()in a loop. This comes handy when a guest kernel is booted inside QEMU. Without the patch, the host operating system will consume cpu time busy waiting.There are two similar loops involving
CONF_PRE_OPENandCONF_POST_OPEN, you may wish to hit those while you're at it.
Huh? You mean _removing_ the timeouts involving CONF_PRE/POST_OPEN? I thought my patch converted all busy waits into schedule_timeout()... What am I missing?
/ magnus
David S. Miller
maintainerQuoted 12 lines · On Wed, 24 Nov 2004 00:42:17 +0100 Magnus Damm <[email protected]> wrote:
Quoted 11 lines · David S. Miller
On Tue, 23 Nov 2004 23:50:35 +0100
Quoted 5 lines · Magnus Damm
This simple patch makes the DHCP/BOOTP/RARP code sleep with
schedule_timeout()instead of hogging the cpu withcpu_relax()in a loop. This comes handy when a guest kernel is booted inside QEMU. Without the patch, the host operating system will consume cpu time busy waiting.
Quoted 6 lines
Quoted 2 lines
There are two similar loops involving
CONF_PRE_OPENandCONF_POST_OPEN, you may wish to hit those while you're at it.Huh? You mean _removing_ the timeouts involving CONF_PRE/POST_OPEN? I thought my patch converted all busy waits into
schedule_timeout()... What am I missing?
No, not removing them, but transforming them likewise into schedule_timeout() calls.
Quoted 20 lines · David S. Miller
On Wed, 24 Nov 2004 00:42:17 +0100
Quoted 15 lines · Magnus Damm
Quoted 13 lines · David S. Miller
On Tue, 23 Nov 2004 23:50:35 +0100
Quoted 5 lines · Magnus Damm
This simple patch makes the DHCP/BOOTP/RARP code sleep with
schedule_timeout()instead of hogging the cpu withcpu_relax()in a loop. This comes handy when a guest kernel is booted inside QEMU. Without the patch, the host operating system will consume cpu time busy waiting.There are two similar loops involving
CONF_PRE_OPENandCONF_POST_OPEN, you may wish to hit those while you're at it.
Quoted 6 lines
Quoted 3 lines
Huh? You mean _removing_ the timeouts involving CONF_PRE/POST_OPEN? I thought my patch converted all busy waits into
schedule_timeout()... What am I missing?No, not removing them, but transforming them likewise into
schedule_timeout()calls.
Yeah, but isn't the patch already doing that? I tried to find more occurances of CONF_PRE/POST_OPEN in the linux-2.6.10-rc2-mm3/net/ipv4/ipconfig.c but I think the patch covers all of them. Please point out what I am missing, maybe it is getting too late for me know...
/ magnus