Skip to content

Commit 9c3a815

Browse files
committed
page waitqueue: always add new entries at the end
Commit 3510ca2 ("Minor page waitqueue cleanups") made the page queue code always add new waiters to the back of the queue, which helps upcoming patches to batch the wakeups for some horrid loads where the wait queues grow to thousands of entries. However, I forgot about the nasrt add_page_wait_queue() special case code that is only used by the cachefiles code. That one still continued to add the new wait queue entries at the beginning of the list. Fix it, because any sane batched wakeup will require that we don't suddenly start getting new entries at the beginning of the list that we already handled in a previous batch. [ The current code always does the whole list while holding the lock, so wait queue ordering doesn't matter for correctness, but even then it's better to add later entries at the end from a fairness standpoint ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b339752 commit 9c3a815

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/filemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter)
10411041
unsigned long flags;
10421042

10431043
spin_lock_irqsave(&q->lock, flags);
1044-
__add_wait_queue(q, waiter);
1044+
__add_wait_queue_entry_tail(q, waiter);
10451045
SetPageWaiters(page);
10461046
spin_unlock_irqrestore(&q->lock, flags);
10471047
}

0 commit comments

Comments
 (0)