diff options
author | Sven Wegener <sven.wegener@stealer.net> | 2008-07-16 07:13:56 -0400 |
---|---|---|
committer | Sven Wegener <sven.wegener@stealer.net> | 2008-07-16 18:33:20 -0400 |
commit | ba6fd85021dec97d58373d9aea4bea8fc24258be (patch) | |
tree | 4c79457a5cb6dbf634de1c0d3e95f6261199c704 | |
parent | 998e7a76804b7a273a0460c2cdd5a51fa9856717 (diff) |
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 <sven.wegener@stealer.net>
Acked-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | net/ipv4/ipvs/ip_vs_sync.c | 7 |
1 files changed, 5 insertions, 2 deletions
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 @@ | |||
29 | #include <linux/udp.h> | 29 | #include <linux/udp.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <linux/kthread.h> | 31 | #include <linux/kthread.h> |
32 | #include <linux/wait.h> | ||
32 | 33 | ||
33 | #include <net/ip.h> | 34 | #include <net/ip.h> |
34 | #include <net/sock.h> | 35 | #include <net/sock.h> |
@@ -772,6 +773,10 @@ static int sync_thread_backup(void *data) | |||
772 | ip_vs_backup_mcast_ifn, ip_vs_backup_syncid); | 773 | ip_vs_backup_mcast_ifn, ip_vs_backup_syncid); |
773 | 774 | ||
774 | while (!kthread_should_stop()) { | 775 | while (!kthread_should_stop()) { |
776 | wait_event_interruptible(*tinfo->sock->sk->sk_sleep, | ||
777 | !skb_queue_empty(&tinfo->sock->sk->sk_receive_queue) | ||
778 | || kthread_should_stop()); | ||
779 | |||
775 | /* do we have data now? */ | 780 | /* do we have data now? */ |
776 | while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) { | 781 | while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) { |
777 | len = ip_vs_receive(tinfo->sock, tinfo->buf, | 782 | len = ip_vs_receive(tinfo->sock, tinfo->buf, |
@@ -787,8 +792,6 @@ static int sync_thread_backup(void *data) | |||
787 | ip_vs_process_message(tinfo->buf, len); | 792 | ip_vs_process_message(tinfo->buf, len); |
788 | local_bh_enable(); | 793 | local_bh_enable(); |
789 | } | 794 | } |
790 | |||
791 | msleep_interruptible(1000); | ||
792 | } | 795 | } |
793 | 796 | ||
794 | /* release the sending multicast socket */ | 797 | /* release the sending multicast socket */ |