netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
[parent not found: <4857F579020000B30004963C@lucius.provo.novell.com>]
* Re: [PATCH] net/core/sock.c remove extra wakeup
@ 2008-05-30 10:05 Gregory Haskins
  2008-06-11  6:46 ` Herbert Xu
  0 siblings, 1 reply; 20+ messages in thread
From: Gregory Haskins @ 2008-05-30 10:05 UTC (permalink / raw)
  To: davem, Patrick Mullaney; +Cc: netdev

Sorry for the top post (on a phone)

Point taken that the fix needs to be analysed for races, but the problem is very real.  We noticed that our udp netperf test would get two wake-ups per packet.  I don't remember the exact path where the udp waits occur off the top of my head, but the fundamental problem is the overloaded use of the single wait-queue.

So basically it was waiting for a packet to arrive, and the net-rx softirq would first trigger a NOSPACE wakeup (of which was a noop by the udp-rx code) followed by an rx-wakeup.  So the netperf thread woke twice for one packet.  Fixing this boosted performance by a large margin (don't recall exact figures off the top of my head....somewhere around 20%)

Long stort short, its potentially worth fixing this, even if this patch isn't "it" :)

HTH

Regards
-Greg  
 
-----Original Message-----
From: David Miller <davem@davemloft.net>
To: Patrick Mullaney <PMullaney@novell.com>
Cc: Gregory Haskins <GHaskins@novell.com>
Cc:  <netdev@vger.kernel.org>

Sent: 5/30/2008 3:52:54 AM
Subject: Re: [PATCH] net/core/sock.c remove extra wakeup

From: "Patrick Mullaney" <pmullaney@novell.com>
Date: Thu, 29 May 2008 10:08:43 -0600

> We have noticed an extra wakeup of a task waiting on a udp receive
> while testing with CONFIG_PREEMPT_RT. The following patch
> eliminates the source of the extra wakeup by only waking a task
> if it is waiting on the writable condition(the SOCK_NOSPACE
> bit has been set). The patch is against 2.6.25.
> 
> Signed-off-by: Patrick Mullaney <pmullaney@novell.com>

This looks Ok on the surface, but I'm really worried about
races.

If you clear that bit, another thread which set that bit
and already checked the socket space, might sleep and never
wake up.

I think that is fundamentally why we don't try to optimize
this in that way.

And why is this so expensive?  Once the first wakeup occurs,
the subsequent attemps will merely see that the wait queue
is empty and do nothing.

The only cost is the read lock on the callback lock, and that
is about as expensive as this new atomic operation you are
adding to clear the SOCK_NOSPACE bit.

So the benefit is not clear, and neither is the correctness of
this change.

Sorry.


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2008-06-18 16:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <484F43A3020000760003F543@lucius.provo.novell.com>
2008-06-17  1:38 ` Killing sk->sk_callback_lock (was Re: [PATCH] net/core/sock.c remove extra wakeup) Patrick Mullaney
2008-06-17  1:53   ` Killing sk->sk_callback_lock David Miller
2008-06-17  4:01     ` Gregory Haskins
2008-06-17  4:09       ` David Miller
2008-06-17  4:20         ` Gregory Haskins
2008-06-17  4:30           ` Gregory Haskins
2008-06-17  4:22       ` Fwd: " Gregory Haskins
2008-06-17  4:56       ` David Miller
2008-06-17 11:42         ` Gregory Haskins
2008-06-17 13:38     ` Patrick Mullaney
2008-06-17 21:40       ` David Miller
2008-06-17 22:15         ` Patrick Mullaney
2008-06-17 23:24           ` Herbert Xu
2008-06-18  7:36         ` Remi Denis-Courmont
2008-06-17  2:56   ` Killing sk->sk_callback_lock (was Re: [PATCH] net/core/sock.c remove extra wakeup) Herbert Xu
2008-06-17  3:09     ` Eric Dumazet
2008-06-17 23:33   ` Herbert Xu
     [not found] <4857F579020000B30004963C@lucius.provo.novell.com>
2008-06-18 16:49 ` Patrick Mullaney
2008-05-30 10:05 [PATCH] net/core/sock.c remove extra wakeup Gregory Haskins
2008-06-11  6:46 ` Herbert Xu
2008-06-11  9:16   ` Killing sk->sk_callback_lock (was Re: [PATCH] net/core/sock.c remove extra wakeup) David Miller
2008-06-12 14:05     ` Herbert Xu

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).