Skip to content

Commit

Permalink
ipvs: Put backup thread on mcast socket wait queue
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Simon Horman <[email protected]>
  • Loading branch information
swegener committed Jul 16, 2008
1 parent 998e7a7 commit ba6fd85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/ipv4/ipvs/ip_vs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/udp.h>
#include <linux/err.h>
#include <linux/kthread.h>
#include <linux/wait.h>

#include <net/ip.h>
#include <net/sock.h>
Expand Down Expand Up @@ -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,
Expand All @@ -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 */
Expand Down

0 comments on commit ba6fd85

Please sign in to comment.