* [PATCH] ipconfig schedule fix
@ 2004-11-23 22:50 Magnus Damm
2004-11-23 23:18 ` David S. Miller
0 siblings, 1 reply; 5+ messages in thread
From: Magnus Damm @ 2004-11-23 22:50 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: linux-2.6.10-rc2-mm3-ipconfig_schedule.patch --]
[-- Type: text/x-patch; name="linux-2.6.10-rc2-mm3-ipconfig_schedule.patch", Size: 1293 bytes --]
--- linux-2.6.10-rc2-mm3/net/ipv4/ipconfig.c 2004-10-18 23:53:08.000000000 +0200
+++ linux-2.6.10-rc2-mm3-ipconfig_schedule/net/ipv4/ipconfig.c 2004-11-23 23:21:26.154463880 +0100
@@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] ipconfig schedule fix
2004-11-23 22:50 [PATCH] ipconfig schedule fix Magnus Damm
@ 2004-11-23 23:18 ` David S. Miller
2004-11-23 23:42 ` Magnus Damm
0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2004-11-23 23:18 UTC (permalink / raw)
To: Magnus Damm; +Cc: netdev
On Tue, 23 Nov 2004 23:50:35 +0100
Magnus Damm <magnus.damm@gmail.com> wrote:
> 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.
There are two similar loops involving CONF_PRE_OPEN and CONF_POST_OPEN,
you may wish to hit those while you're at it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ipconfig schedule fix
2004-11-23 23:18 ` David S. Miller
@ 2004-11-23 23:42 ` Magnus Damm
2004-11-23 23:45 ` David S. Miller
0 siblings, 1 reply; 5+ messages in thread
From: Magnus Damm @ 2004-11-23 23:42 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
On Tue, 23 Nov 2004 15:18:55 -0800, David S. Miller <davem@davemloft.net> wrote:
> On Tue, 23 Nov 2004 23:50:35 +0100
>
>
> Magnus Damm <magnus.damm@gmail.com> wrote:
>
> > 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.
>
> There are two similar loops involving CONF_PRE_OPEN and CONF_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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ipconfig schedule fix
2004-11-23 23:42 ` Magnus Damm
@ 2004-11-23 23:45 ` David S. Miller
2004-11-24 0:02 ` Magnus Damm
0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2004-11-23 23:45 UTC (permalink / raw)
To: Magnus Damm; +Cc: netdev
On Wed, 24 Nov 2004 00:42:17 +0100
Magnus Damm <magnus.damm@gmail.com> wrote:
> On Tue, 23 Nov 2004 15:18:55 -0800, David S. Miller <davem@davemloft.net> wrote:
> > On Tue, 23 Nov 2004 23:50:35 +0100
> >
> >
> > Magnus Damm <magnus.damm@gmail.com> wrote:
> >
> > > 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.
> >
> > There are two similar loops involving CONF_PRE_OPEN and CONF_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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ipconfig schedule fix
2004-11-23 23:45 ` David S. Miller
@ 2004-11-24 0:02 ` Magnus Damm
0 siblings, 0 replies; 5+ messages in thread
From: Magnus Damm @ 2004-11-24 0:02 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
On Tue, 23 Nov 2004 15:45:13 -0800, David S. Miller <davem@davemloft.net> wrote:
> On Wed, 24 Nov 2004 00:42:17 +0100
>
>
> Magnus Damm <magnus.damm@gmail.com> wrote:
>
> > On Tue, 23 Nov 2004 15:18:55 -0800, David S. Miller <davem@davemloft.net> wrote:
> > > On Tue, 23 Nov 2004 23:50:35 +0100
> > >
> > >
> > > Magnus Damm <magnus.damm@gmail.com> wrote:
> > >
> > > > 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.
> > >
> > > There are two similar loops involving CONF_PRE_OPEN and CONF_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.
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-11-24 0:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-23 22:50 [PATCH] ipconfig schedule fix Magnus Damm
2004-11-23 23:18 ` David S. Miller
2004-11-23 23:42 ` Magnus Damm
2004-11-23 23:45 ` David S. Miller
2004-11-24 0:02 ` Magnus Damm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).