Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753337AbdLNPYz (ORCPT ); Thu, 14 Dec 2017 10:24:55 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:44553 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752671AbdLNPYw (ORCPT ); Thu, 14 Dec 2017 10:24:52 -0500 From: Christoph Hellwig To: Ingo Molnar , Peter Zijlstra Cc: Andrew Morton , Al Viro , Andrea Arcangeli , Mike Rapoport , Jason Baron , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] sched/wait: assert the wait_queue_head lock is held in __wake_up_common Date: Thu, 14 Dec 2017 16:23:44 +0100 Message-Id: <20171214152344.6880-4-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171214152344.6880-1-hch@lst.de> References: <20171214152344.6880-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 782 Lines: 25 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 Acked-by: Ingo Molnar --- kernel/sched/wait.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index 929ecb7d6b78..d09c4de4865c 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