From ba6fd85021dec97d58373d9aea4bea8fc24258be Mon Sep 17 00:00:00 2001 From: Sven Wegener Date: Wed, 16 Jul 2008 11:13:56 +0000 Subject: ipvs: Put backup thread on mcast socket wait queue Instead of doing an endless loop with sleeping for one second, we now put the backup thread onto the mcast socket wait queue and it gets woken up as soon as we have data to process. Signed-off-by: Sven Wegener Acked-by: Simon Horman --- net/ipv4/ipvs/ip_vs_sync.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'net/ipv4/ipvs') diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 550563a56607..cf5ed758ea1f 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -772,6 +773,10 @@ static int sync_thread_backup(void *data) ip_vs_backup_mcast_ifn, ip_vs_backup_syncid); while (!kthread_should_stop()) { + wait_event_interruptible(*tinfo->sock->sk->sk_sleep, + !skb_queue_empty(&tinfo->sock->sk->sk_receive_queue) + || kthread_should_stop()); + /* do we have data now? */ while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) { len = ip_vs_receive(tinfo->sock, tinfo->buf, @@ -787,8 +792,6 @@ static int sync_thread_backup(void *data) ip_vs_process_message(tinfo->buf, len); local_bh_enable(); } - - msleep_interruptible(1000); } /* release the sending multicast socket */ -- cgit v1.2.1