I was looking at the pagebuf code while I noted that
set_buffer_dirty_uptodate (pagebuf/page_buf_io.c:1188) may sleep waiting
for bdflush to clean some dirty buffers because it calls balance_dirty().
set_buffer_dirty_update is called by functions which are part of the XFS's
writepage codepath, which basically starts at linvfs_write_full_page
The issue is that linvfs_write_full_page() is taking a vnode lock before
going through this codepath, meaning that it can sleep waiting for bdflush
while holding this lock which seems to be unecessary.
If this "vnode lock" suffers from contention because processes sleep while
holding it, we can fix it by calling balance_dirty() _after_ we drop the
In practice, this vnode lock is a being used concurrently by a lot of