From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam03on0134.outbound.protection.outlook.com ([104.47.42.134]:46538 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752693AbeA1W1g (ORCPT ); Sun, 28 Jan 2018 17:27:36 -0500 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Omar Sandoval , Linus Torvalds , Thomas Gleixner , "kernel-team@fb.com" , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 061/100] sched/wait: Fix add_wait_queue() behavioral change Date: Sun, 28 Jan 2018 22:26:38 +0000 Message-ID: <20180128222547.7398-61-alexander.levin@microsoft.com> References: <20180128222547.7398-1-alexander.levin@microsoft.com> In-Reply-To: <20180128222547.7398-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Omar Sandoval [ Upstream commit c6b9d9a33029014446bd9ed84c1688f6d3d4eab9 ] The following cleanup commit: 50816c48997a ("sched/wait: Standardize internal naming of wait-queue entr= ies") ... unintentionally 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. Beyond a negative performance impact this change in behavior theoretically also 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 Reviewed-by: Jens Axboe Acked-by: Peter Zijlstra Cc: Linus Torvalds Cc: Thomas Gleixner Cc: kernel-team@fb.com Fixes: ("sched/wait: Standardize internal naming of wait-queue entries") Link: http://lkml.kernel.org/r/a16c8ccffd39bd08fdaa45a5192294c784b803a7.151= 2544324.git.osandov@fb.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- 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, stru= ct wait_queue_entry *wq =20 wq_entry->flags &=3D ~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); --=20 2.11.0