On Mon, Nov 02, 2020 at 06:42:59PM +0000, Matthew Wilcox (Oracle) wrote: > For page splitting to succeed, the thread asking to split the > page has to be the only one with a reference to the page. Calling > wait_on_page_locked() while holding a reference to the page will > effectively prevent this from happening with sufficient threads waiting > on the same page. Use put_and_wait_on_page_locked() to sleep without > holding a reference to the page, then retry the page lookup after the > page is unlocked. > > Since we now get the page lock a little earlier in filemap_update_page(), > we can eliminate a number of duplicate checks. The original intent > (commit ebded02788b5 ("avoid unnecessary calls to lock_page when waiting > for IO to complete during a read")) behind getting the page lock later > was to avoid re-locking the page after it has been brought uptodate by > another thread. We still avoid that because we go through the normal > lookup path again after the winning thread has brought the page uptodate. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Reviewed-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>