]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ext3 scheduling latency fix
authorAndrew Morton <akpm@osdl.org>
Mon, 29 Dec 2003 13:43:22 +0000 (05:43 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 29 Dec 2003 13:43:22 +0000 (05:43 -0800)
Sometimes kjournald has to refile a huge number of buffers, because someone
else wrote them out beforehand - they are all clean.

This happens under a lock and scheduling latencies of 88 milliseconds on a
2.7GHx CPU were observed.

The patch forward-ports a little bit of the 2.4 low-latency patch to fix this
problem.

Worst-case on ext3 is now sub-half-millisecond, except for when the RCU
dentry reaping softirq cuts in :(

fs/jbd/commit.c

index 4ee3c3e18f436ff7a0a9a21ae91da3997196f5ac..78aaded6d2d9e42c8524f00e8bf0054d63ae4fc5 100644 (file)
@@ -264,6 +264,16 @@ write_out_data_locked:
                                jbd_unlock_bh_state(bh);
                                journal_remove_journal_head(bh);
                                __brelse(bh);
+                               if (need_resched() && commit_transaction->
+                                                       t_sync_datalist) {
+                                       commit_transaction->t_sync_datalist =
+                                                               next_jh;
+                                       if (bufs)
+                                               break;
+                                       spin_unlock(&journal->j_list_lock);
+                                       cond_resched();
+                                       goto write_out_data;
+                               }
                        }
                }
                if (bufs == ARRAY_SIZE(wbuf)) {
@@ -284,8 +294,7 @@ write_out_data_locked:
                cond_resched();
                journal_brelse_array(wbuf, bufs);
                spin_lock(&journal->j_list_lock);
-               if (bufs)
-                       goto write_out_data_locked;
+               goto write_out_data_locked;
        }
 
        /*