Blob Blame History Raw
From 4ef46ca52bda374b8f4df3ca8f69b814ac4cacb2 Mon Sep 17 00:00:00 2001
From: Omar Sandoval <osandov@fb.com>
Date: Wed, 6 Dec 2017 10:46:38 +0000
Subject: [PATCH] sched/wait: fix add_wait_queue() behavior change

References: bnc#971975 VM performance -- page waitqueue
Patch-mainline: v4.15-rc3
Git-commit: c6b9d9a33029014446bd9ed84c1688f6d3d4eab9

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 <osandov@fb.com>
Signed-off-by: Mel Gorman <mgorman@suse.de>
---
 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);