From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin LaHaise Subject: [JBD] change batching logic to improve O_SYNC performance Date: Thu, 15 Dec 2005 09:59:51 -0500 Message-ID: <20051215145951.GB2444@kvack.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from kanga.kvack.org ([66.96.29.28]:50336 "EHLO kanga.kvack.org") by vger.kernel.org with ESMTP id S1750746AbVLOPDE (ORCPT ); Thu, 15 Dec 2005 10:03:04 -0500 To: akpm@osdl.org, sct@redhat.com Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hello folks, When writing files out using O_SYNC, jbd's 1 jiffy delay results in a significant drop in throughput as the disk sits idle. The patch below results in a 4-5x performance improvement (from 6.5MB/s to ~24-30MB/s on my IDE test box) when writing out files using O_SYNC. Instead of always delaying for 1 jiffy when trying to batch, merely do a yield() to allow other processes to execute and potentially batch requests. Additionally, limit the delay to an absolute max of 1/50th of a second. -ben Signed-off-by: Benjamin LaHaise diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 429f4b2..9c84ad0 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c @@ -1335,10 +1335,12 @@ int journal_stop(handle_t *handle) * by 30x or more... */ if (handle->h_sync) { + long start = jiffies; do { old_handle_count = transaction->t_handle_count; - schedule_timeout_uninterruptible(1); - } while (old_handle_count != transaction->t_handle_count); + yield(); + } while (old_handle_count != transaction->t_handle_count && + (jiffies - start < HZ/50)); } current->journal_info = NULL; -- "You know, I've seen some crystals do some pretty trippy shit, man." Don't Email: .