Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101AbdLFHPl (ORCPT ); Wed, 6 Dec 2017 02:15:41 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:42136 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752704AbdLFHPi (ORCPT ); Wed, 6 Dec 2017 02:15:38 -0500 X-Google-Smtp-Source: AGs4zMb2pt4GLRi2GIjEJ4QpfgZVy6j4Pu1nksnuPLN/c4sHTGS9YcNdzbnNr0nsDuo3s1bvtJCYTw== From: Omar Sandoval To: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Peter Zijlstra Cc: kernel-team@fb.com Subject: [PATCH] sched/wait: fix add_wait_queue() behavior change Date: Tue, 5 Dec 2017 23:15:31 -0800 Message-Id: X-Mailer: git-send-email 2.15.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1253 Lines: 33 From: Omar Sandoval Commit 50816c48997a ("sched/wait: Standardize internal naming of wait-queue entries") changed the behavior of add_wait_queue() from inserting the wait entry at the head of the wait queue to the tail of the wait queue. That commit was a cleanup and didn't mention any functional changes so it was likely unintentional. This change in behavior theoretically breaks wait queues which mix exclusive and non-exclusive waiters, as non-exclusive waiters will not be woken up if they are queued behind enough exclusive waiters. Signed-off-by: Omar Sandoval --- Since Ingo hasn't replied, here's a proper patch. kernel/sched/wait.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index 98feab7933c7..929ecb7d6b78 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -27,7 +27,7 @@ void add_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq wq_entry->flags &= ~WQ_FLAG_EXCLUSIVE; spin_lock_irqsave(&wq_head->lock, flags); - __add_wait_queue_entry_tail(wq_head, wq_entry); + __add_wait_queue(wq_head, wq_entry); spin_unlock_irqrestore(&wq_head->lock, flags); } EXPORT_SYMBOL(add_wait_queue); -- 2.15.1