All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ingo Molnar <mingo@redhat.com>, eter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] sched/wait: assert the wait_queue_head lock is held in __wake_up_common
Date: Thu, 30 Nov 2017 06:20:36 -0800	[thread overview]
Message-ID: <20171130142037.19339-2-hch@lst.de> (raw)
In-Reply-To: <20171130142037.19339-1-hch@lst.de>

Better ensure we actually hold the lock using lockdep than just commenting
on it.  Due to the various exported _locked interfaces it is far too easy
to get the locking wrong.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 kernel/sched/wait.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
index 98feab7933c7..347c06c8222e 100644
--- a/kernel/sched/wait.c
+++ b/kernel/sched/wait.c
@@ -76,6 +76,8 @@ static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
 	wait_queue_entry_t *curr, *next;
 	int cnt = 0;
 
+	lockdep_assert_held(&wq_head->lock);
+
 	if (bookmark && (bookmark->flags & WQ_FLAG_BOOKMARK)) {
 		curr = list_next_entry(bookmark, entry);
 
-- 
2.14.2

  reply	other threads:[~2017-11-30 14:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 14:20 waitqueue lockdep annotation Christoph Hellwig
2017-11-30 14:20 ` Christoph Hellwig [this message]
2017-11-30 14:20 ` [PATCH 2/2] epoll: use proper wake_up variant in ep_poll_callback Christoph Hellwig
2017-11-30 20:50 ` waitqueue lockdep annotation Andrew Morton
2017-11-30 21:38   ` Jason Baron
2017-11-30 22:11     ` Christoph Hellwig
2017-11-30 22:18       ` Jason Baron
2017-12-01 17:11         ` Christoph Hellwig
2017-12-01 19:00           ` Jason Baron
2017-12-01 22:02             ` Christoph Hellwig
2017-12-01 22:34               ` Jason Baron
2017-12-01 23:03                 ` Christoph Hellwig
2017-12-05 15:24                   ` Jason Baron
2017-12-05 15:36                     ` Davidlohr Bueso
2017-12-06 23:51                     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171130142037.19339-2-hch@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.