0022-sched-wait-Fix-add_wait_queue-behavioral-change.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Omar Sandoval <[email protected]>
  3. Date: Tue, 5 Dec 2017 23:15:31 -0800
  4. Subject: [PATCH] sched/wait: Fix add_wait_queue() behavioral change
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. The following cleanup commit:
  9. 50816c48997a ("sched/wait: Standardize internal naming of wait-queue entries")
  10. ... unintentionally changed the behavior of add_wait_queue() from
  11. inserting the wait entry at the head of the wait queue to the tail
  12. of the wait queue.
  13. Beyond a negative performance impact this change in behavior
  14. theoretically also breaks wait queues which mix exclusive and
  15. non-exclusive waiters, as non-exclusive waiters will not be
  16. woken up if they are queued behind enough exclusive waiters.
  17. Signed-off-by: Omar Sandoval <[email protected]>
  18. Reviewed-by: Jens Axboe <[email protected]>
  19. Acked-by: Peter Zijlstra <[email protected]>
  20. Cc: Linus Torvalds <[email protected]>
  21. Cc: Thomas Gleixner <[email protected]>
  22. Cc: [email protected]
  23. Fixes: ("sched/wait: Standardize internal naming of wait-queue entries")
  24. Link: http://lkml.kernel.org/r/a16c8ccffd39bd08fdaa45a5192294c784b803a7.1512544324.git.osandov@fb.com
  25. Signed-off-by: Ingo Molnar <[email protected]>
  26. (cherry picked from commit c6b9d9a33029014446bd9ed84c1688f6d3d4eab9)
  27. Signed-off-by: Fabian Grünbichler <[email protected]>
  28. ---
  29. kernel/sched/wait.c | 2 +-
  30. 1 file changed, 1 insertion(+), 1 deletion(-)
  31. diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c
  32. index d6afed6d0752..c09ebe92a40a 100644
  33. --- a/kernel/sched/wait.c
  34. +++ b/kernel/sched/wait.c
  35. @@ -27,7 +27,7 @@ void add_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry *wq
  36. wq_entry->flags &= ~WQ_FLAG_EXCLUSIVE;
  37. spin_lock_irqsave(&wq_head->lock, flags);
  38. - __add_wait_queue_entry_tail(wq_head, wq_entry);
  39. + __add_wait_queue(wq_head, wq_entry);
  40. spin_unlock_irqrestore(&wq_head->lock, flags);
  41. }
  42. EXPORT_SYMBOL(add_wait_queue);
  43. --
  44. 2.14.2