From: Peter Zijlstra Date: Wed, 24 Sep 2014 08:18:54 +0000 (+0200) Subject: sched, net: Clean up sk_wait_event() vs. might_sleep() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=26cabd31259ba43f68026ce3f62b78094124333f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git sched, net: Clean up sk_wait_event() vs. might_sleep() WARNING: CPU: 1 PID: 1744 at kernel/sched/core.c:7104 __might_sleep+0x58/0x90() do not call blocking ops when !TASK_RUNNING; state=1 set at [] prepare_to_wait+0x50 /0xa0 [] __might_sleep+0x58/0x90 [] lock_sock_nested+0x31/0xb0 [] sk_stream_wait_memory+0x18a/0x2d0 Which is a false positive because sk_wait_event() will already have TASK_RUNNING at that point if it would've gone through schedule_timeout(). So annotate with sched_annotate_sleep(); which goes away on !DEBUG builds. Reported-by: Ilya Dryomov Signed-off-by: Peter Zijlstra (Intel) Link: http://lkml.kernel.org/r/20140924082242.524407432@infradead.org Cc: David S. Miller Cc: Linus Torvalds Cc: netdev@vger.kernel.org Cc: tglx@linutronix.de Cc: ilya.dryomov@inktank.com Cc: umgwanakikbuti@gmail.com Cc: oleg@redhat.com Signed-off-by: Ingo Molnar --- diff --git a/include/net/sock.h b/include/net/sock.h index 7db3db112baa..e6f235ebf6c9 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -897,6 +897,7 @@ static inline void sock_rps_reset_rxhash(struct sock *sk) if (!__rc) { \ *(__timeo) = schedule_timeout(*(__timeo)); \ } \ + sched_annotate_sleep(); \ lock_sock(__sk); \ __rc = __condition; \ __rc; \