From: Tung Nguyen Date: Tue, 19 Feb 2019 04:20:47 +0000 (+0700) Subject: tipc: improve function tipc_wait_for_cond() X-Git-Tag: v4.14.310~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79f749ade7a61a56b9fe249a0a53ce8803b48b3e;p=thirdparty%2Fkernel%2Fstable.git tipc: improve function tipc_wait_for_cond() commit 223b7329ec6a0dae1b7f7db7b770e93f4a069ef9 upstream. Commit 844cf763fba6 ("tipc: make macro tipc_wait_for_cond() smp safe") replaced finish_wait() with remove_wait_queue() but still used prepare_to_wait(). This causes unnecessary conditional checking before adding to wait queue in prepare_to_wait(). This commit replaces prepare_to_wait() with add_wait_queue() as the pair function with remove_wait_queue(). Acked-by: Ying Xue Acked-by: Jon Maloy Signed-off-by: Tung Nguyen Signed-off-by: David S. Miller Cc: Lee Jones Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 40002d2afb8aa..5d9d9d693da04 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -373,7 +373,7 @@ static int tipc_sk_sock_err(struct socket *sock, long *timeout) rc_ = tipc_sk_sock_err((sock_), timeo_); \ if (rc_) \ break; \ - prepare_to_wait(sk_sleep(sk_), &wait_, TASK_INTERRUPTIBLE); \ + add_wait_queue(sk_sleep(sk_), &wait_); \ release_sock(sk_); \ *(timeo_) = wait_woken(&wait_, TASK_INTERRUPTIBLE, *(timeo_)); \ sched_annotate_sleep(); \