netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/core/sock.c remove extra wakeup
@ 2008-05-29 16:08 Patrick Mullaney
  2008-05-30  9:52 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Mullaney @ 2008-05-29 16:08 UTC (permalink / raw)
  To: davem; +Cc: Gregory Haskins, netdev


From: Patrick Mullaney <pmullaney@novell.com>

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

 net/core/sock.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 7a0567b..df08fb2 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1628,12 +1628,17 @@ static void sock_def_readable(struct sock *sk, int len)
 
 static void sock_def_write_space(struct sock *sk)
 {
+	/* don't wake unless writer is waiting */
+	if(!test_bit(SOCK_NOSPACE, &sk->sk_socket->flags))
+		return;
+
 	read_lock(&sk->sk_callback_lock);
 
 	/* Do not wake up a writer until he can make "significant"
 	 * progress.  --DaveM
 	 */
 	if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) {
+		clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
 		if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
 			wake_up_interruptible_sync(sk->sk_sleep);
 




^ permalink raw reply related	[flat|nested] 7+ messages in thread
[parent not found: <483F99090200005A00037FFE@sinclair.provo.novell.com>]
[parent not found: <483F99090200005A00037FFE@lucius.provo.novell.com>]

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-29 16:08 [PATCH] net/core/sock.c remove extra wakeup Patrick Mullaney
2008-05-30  9:52 ` David Miller
     [not found] <483F99090200005A00037FFE@sinclair.provo.novell.com>
2008-05-30 10:05 ` Gregory Haskins
2008-06-11  6:46   ` Herbert Xu
2008-06-16  3:48     ` Gregory Haskins
     [not found] <483F99090200005A00037FFE@lucius.provo.novell.com>
     [not found] ` <483F990C0200005A00038001@lucius.provo.novell.com>
2008-05-30 17:00   ` Patrick Mullaney
2008-06-01 21:03     ` Andi Kleen

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