From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f194.google.com ([209.85.128.194]:33055 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752288AbeBKKcI (ORCPT ); Sun, 11 Feb 2018 05:32:08 -0500 Received: by mail-wr0-f194.google.com with SMTP id s5so12380750wra.0 for ; Sun, 11 Feb 2018 02:32:07 -0800 (PST) Date: Sun, 11 Feb 2018 11:32:03 +0100 From: Ingo Molnar To: Jens Axboe , Greg Kroah-Hartman Cc: Tetsuo Handa , osandov@fb.com, stable@vger.kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, tglx@linutronix.de, kernel-team@fb.com Subject: Re: sched/wait: Fix add_wait_queue() behavioral change Message-ID: <20180211103203.tt3w3dhlu2bn5bom@gmail.com> References: <201802102314.AGJ39032.LMFJFtOSOQFVOH@I-love.SAKURA.ne.jp> <9a183b1a-e6e2-bed1-4816-694b54594cbc@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a183b1a-e6e2-bed1-4816-694b54594cbc@kernel.dk> Sender: stable-owner@vger.kernel.org List-ID: * Jens Axboe wrote: > On 2/10/18 7:14 AM, Tetsuo Handa wrote: > > Recently, we are seeing I/O hungup reports. > > > > I don't know whether a regression introduced by commit 50816c48997af857 > > ("sched/wait: Standardize internal naming of wait-queue entries") is relevant. > > But shouldn't we backport commit c6b9d9a330290144 ("sched/wait: Fix > > add_wait_queue() behavioral change") to 4.13+ kernels anyway? > > Yes, it most certainly should! Indeed, the bug was introduced in v4.13 and the fix was included in v4.15, but it's missing from v4.13 and v4.14 - not sure how I missed that. The fix (also attached below) applies cleanly to both v4.13 and v4.14: Acked-by: Ingo Molnar Thanks, Ingo ===================> >>From c6b9d9a33029014446bd9ed84c1688f6d3d4eab9 Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Tue, 5 Dec 2017 23:15:31 -0800 Subject: [PATCH] sched/wait: Fix add_wait_queue() behavioral change The following cleanup commit: 50816c48997a ("sched/wait: Standardize internal naming of wait-queue entries") ... 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.1512544324.git.osandov@fb.com Signed-off-by: Ingo Molnar --- 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);