sched, wait: Make the __wait_event*() interface more friendly
Hello,
Quoted 10 lines · Peter Zijlstra
Review static int sync_thread_master(void *data · line 1640
Quoted 9 lines
+++
b/net/netfilter/ipvs/ip_vs_sync.c(quoted diff) +1
-3@@ -1637,12 +1637,9 @@ static int sync_thread_master(void *data continue; } while (ip_vs_send_sync_msg(tinfo->sock, sb->mesg) < 0) { - int ret = 0; - - __wait_event_interruptible(*sk_sleep(sk), + int ret =
__wait_event_interruptible(*sk_sleep(sk),
Quoted 9 lines
Review static int sync_thread_master(void *data · line 1645
Quoted 7 lines
(quoted diff) +1
-2sock_writeable(sk) || - kthread_should_stop(), - ret); + kthread_should_stop()); if (unlikely(kthread_should_stop())) goto done; }That site seems to be ignoring the interruptible state... seems wrong.
This is a kthread which ignores signals by default.
It terminates only with kthread_stop. I hope it works correctly for such context. This is a loop that polls socket space for writing when there is a buffer for sending.
Regards
--
Julian Anastasov <[email protected]>
Quoted 22 lines · Julian Anastasov
Hello,
Quoted 10 lines · Peter Zijlstra
Review static int sync_thread_master(void *data · line 1640
Quoted 9 lines
+++
b/net/netfilter/ipvs/ip_vs_sync.c(quoted diff) +1
-3@@ -1637,12 +1637,9 @@ static int sync_thread_master(void *data continue; } while (ip_vs_send_sync_msg(tinfo->sock, sb->mesg) < 0) { - int ret = 0; - - __wait_event_interruptible(*sk_sleep(sk), + int ret =__wait_event_interruptible(*sk_sleep(sk),
Quoted 8 lines
Quoted 7 lines
(quoted diff) +1
-2sock_writeable(sk) || - kthread_should_stop(), - ret); + kthread_should_stop()); if (unlikely(kthread_should_stop())) goto done; }
Quoted 4 lines
Quoted 1 line
That site seems to be ignoring the interruptible state... seems wrong.
This is a kthread which ignores signals by default.
It terminates only withkthread_stop.
This only means that (with or without this change) __wait_event_interruptible() generates the dead code but this thread doesn't contribute to load_avg.
Anyway this patch should not makes any difference.
Oleg.
Hello,
Quoted 25 lines · Oleg Nesterov
Quoted 24 lines · Julian Anastasov
Hello,
Quoted 10 lines · Peter Zijlstra
Review static int sync_thread_master(void *data · line 1640
Quoted 9 lines
+++
b/net/netfilter/ipvs/ip_vs_sync.c(quoted diff) +1
-3@@ -1637,12 +1637,9 @@ static int sync_thread_master(void *data continue; } while (ip_vs_send_sync_msg(tinfo->sock, sb->mesg) < 0) { - int ret = 0; - - __wait_event_interruptible(*sk_sleep(sk), + int ret =__wait_event_interruptible(*sk_sleep(sk),
Quoted 9 lines
Review static int sync_thread_master(void *data · line 1645
Quoted 7 lines
(quoted diff) +1
-2sock_writeable(sk) || - kthread_should_stop(), - ret); + kthread_should_stop()); if (unlikely(kthread_should_stop())) goto done; }That site seems to be ignoring the interruptible state... seems wrong.
Quoted 8 lines
Quoted 2 lines
This is a kthread which ignores signals by default.
It terminates only withkthread_stop.This only means that (with or without this change)
__wait_event_interruptible()generates the dead code but this thread doesn't contribute toload_avg.Anyway this patch should not makes any difference.
Yes, your patch looks ok to me. In the past
we used ssleep() but IPVS users were confused why IPVS threads increase the load average. So, we switched to _interruptible calls and later the socket polling was added.
Regards
--
Julian Anastasov <[email protected]>