public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Schmidt <mschmidt@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: [PATCH] ext4: reduce scheduling latency with delayed allocation
Date: Mon, 1 Mar 2010 13:34:35 +0100	[thread overview]
Message-ID: <20100301133435.141c4bc5@leela> (raw)

mpage_da_submit_io() may process tens of thousands of pages at a time.
Unless full preemption is enabled, it causes scheduling latencies in the order
of tens of milliseconds.

It can be reproduced simply by writing a big file on ext4 repeatedly with
dd if=/dev/zero of=/tmp/dummy bs=10M count=50

The patch fixes it by allowing to reschedule in the loop.

cyclictest can be used to measure the latency. I tested with:
$ cyclictest -t1 -p 80 -n -i 5000 -m -l 20000

The results from an UP AMD Turion 2GHz with voluntary preemption:

Without the patch:
T: 0 ( 2535) P:80 I:5000 C:  20000 Min:   12 Act:  23 Avg: 3166 Max:  70524
(i.e. Average latency was more than 3 ms. Max observed latency was 71 ms.)

With the patch:
T: 0 ( 2588) P:80 I:5000 C:  20000 Min:   13 Act:  33 Avg:   49 Max:  11009
(i.e. Average latency was only 49 us. Max observed latency was 11 ms.)

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
 fs/ext4/inode.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e119524..687a993 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2007,6 +2007,7 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd)
 				ret = err;
 		}
 		pagevec_release(&pvec);
+		cond_resched();
 	}
 	return ret;
 }
-- 
1.7.0


             reply	other threads:[~2010-03-01 12:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 12:34 Michal Schmidt [this message]
2010-03-02  3:06 ` [PATCH] ext4: reduce scheduling latency with delayed allocation tytso
2010-03-10 13:09   ` Michal Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100301133435.141c4bc5@leela \
    --to=mschmidt@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox