Commit b345e6d2 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix latencies during writeback

When a throttled writer is performing writeback, and it encounters an inode
which is already under writeback it is forced to wait on the inode.  So that
process sleeps until whoever is writing it out finishes the writeout.

Which is OK - we want to throttle that process, and another process is
currently pumping data at the disk anyway.

But in one situations the delays are excessive.  If one process is performing
a huge linear write, other processes end up waiting for a very long time
indeed.  It appears that this is because the writing process just keeps on
hogging the CPU, returning to userspace, generating more dirty data, writing
it out, sleeping in get_request_wait, etc.  All other throttled dirtiers get
starved.

So just remove the wait altogether if it is just a memory-cleansing writeout.
 The calling process will then throttle in balance_dirty_pages()'s call to
blk_congestion_wait().
parent b21e69ae
...@@ -185,11 +185,14 @@ static void ...@@ -185,11 +185,14 @@ static void
__writeback_single_inode(struct inode *inode, __writeback_single_inode(struct inode *inode,
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
if (current_is_pdflush() && (inode->i_state & I_LOCK)) { if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) {
list_move(&inode->i_list, &inode->i_sb->s_dirty); list_move(&inode->i_list, &inode->i_sb->s_dirty);
return; return;
} }
/*
* It's a data-integrity sync. We must wait.
*/
while (inode->i_state & I_LOCK) { while (inode->i_state & I_LOCK) {
__iget(inode); __iget(inode);
spin_unlock(&inode_lock); spin_unlock(&inode_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment