Signed-off-by: Andrew Morton --- 25-akpm/fs/jbd/commit.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff -puN fs/jbd/commit.c~kjournald-smp-latency-fix fs/jbd/commit.c --- 25/fs/jbd/commit.c~kjournald-smp-latency-fix 2004-07-13 01:14:53.640042408 -0700 +++ 25-akpm/fs/jbd/commit.c 2004-07-13 01:53:01.953165936 -0700 @@ -114,6 +114,7 @@ void journal_commit_transaction(journal_ int space_left = 0; int first_tag = 0; int tag_flag; + int nr_buffers = 0; int i; /* @@ -269,8 +270,10 @@ write_out_data: __journal_file_buffer(jh, commit_transaction, BJ_Locked); jbd_unlock_bh_state(bh); - if (need_resched()) { + nr_buffers++; + if ((nr_buffers & 15) == 0 || need_resched()) { spin_unlock(&journal->j_list_lock); + cpu_relax(); goto write_out_data; } } else { @@ -295,8 +298,10 @@ write_out_data: jbd_unlock_bh_state(bh); journal_remove_journal_head(bh); put_bh(bh); - if (need_resched()) { + nr_buffers++; + if ((nr_buffers & 15) == 0 || need_resched()) { spin_unlock(&journal->j_list_lock); + cpu_relax(); goto write_out_data; } } @@ -340,7 +345,8 @@ write_out_data: jbd_unlock_bh_state(bh); } put_bh(bh); - if (need_resched()) { + nr_buffers++; + if ((nr_buffers & 15) == 0 || need_resched()) { spin_unlock(&journal->j_list_lock); cond_resched(); spin_lock(&journal->j_list_lock); _