Commit ba6fd850 authored by Sven Wegener's avatar Sven Wegener

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: default avatarSven Wegener <sven.wegener@stealer.net>
Acked-by: default avatarSimon Horman <horms@verge.net.au>
parent 998e7a76
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/udp.h> #include <linux/udp.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/wait.h>
#include <net/ip.h> #include <net/ip.h>
#include <net/sock.h> #include <net/sock.h>
...@@ -772,6 +773,10 @@ static int sync_thread_backup(void *data) ...@@ -772,6 +773,10 @@ static int sync_thread_backup(void *data)
ip_vs_backup_mcast_ifn, ip_vs_backup_syncid); ip_vs_backup_mcast_ifn, ip_vs_backup_syncid);
while (!kthread_should_stop()) { 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? */ /* do we have data now? */
while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) { while (!skb_queue_empty(&(tinfo->sock->sk->sk_receive_queue))) {
len = ip_vs_receive(tinfo->sock, tinfo->buf, len = ip_vs_receive(tinfo->sock, tinfo->buf,
...@@ -787,8 +792,6 @@ static int sync_thread_backup(void *data) ...@@ -787,8 +792,6 @@ static int sync_thread_backup(void *data)
ip_vs_process_message(tinfo->buf, len); ip_vs_process_message(tinfo->buf, len);
local_bh_enable(); local_bh_enable();
} }
msleep_interruptible(1000);
} }
/* release the sending multicast socket */ /* release the sending multicast socket */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment