rpms/kernel/F-10 linux-2.6-kjournald-use-rt-io-priority.patch, NONE, 1.1 kernel.spec, 1.1309, 1.1310

Chuck Ebbert cebbert at fedoraproject.org
Sat Mar 28 01:38:54 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11330

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-kjournald-use-rt-io-priority.patch 
Log Message:
Change kjournald to real-time priority to avoid stalls in ext3.

linux-2.6-kjournald-use-rt-io-priority.patch:

--- NEW FILE linux-2.6-kjournald-use-rt-io-priority.patch ---
From: Arjan van de Ven <arjan at linux.intel.com>
Date: Wed, 1 Oct 2008 19:58:18 -0700
Subject: [PATCH] Give kjournald a IOPRIO_CLASS_RT io priority

With latencytop, I noticed that the (in memory) atime updates during a
kernel build had latencies of 6 seconds or longer; this is obviously not so
nice behavior. Other EXT3 journal related operations had similar or even
longer latencies.

Digging into this a bit more, it appears to be an interaction between EXT3
and CFQ in that CFQ tries to be fair to everyone, including kjournald.
However, in reality, kjournald is "special" in that it does a lot of journal
work on behalf of other processes and effectively this leads to a twisted 
kind of "mass priority inversion" type of behavior.

The good news is that CFQ already has the infrastructure to make certain
processes special... JBD just wasn't using that quite yet.

The patch below makes kjournald of the IOPRIO_CLASS_RT priority to break
this priority inversion behavior. With this patch, the latencies for atime
updates (and similar operation) go down by a factor of 3x to 4x !

[cebbert: changed to lowest real-time priority, fix up for 2.6.29]

Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
---
 fs/jbd/journal.c       |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff a/fs/jbd/journal.c b/fs/jbd/journal.c
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -36,6 +36,7 @@
 #include <linux/poison.h>
 #include <linux/proc_fs.h>
 #include <linux/debugfs.h>
+#include <linux/ioprio.h>
 
 #include <asm/uaccess.h>
 #include <asm/page.h>
@@ -131,6 +132,17 @@ static int kjournald(void *arg)
 			journal->j_commit_interval / HZ);
 
 	/*
+	 * kjournald is the process on which most other processes depend on
+	 * for doing the filesystem portion of their IO. As such, there exists
+	 * the equivalent of a priority inversion situation, where kjournald
+	 * would get less priority as it should.
+	 *
+	 * For this reason we set to "lowest real time priority", which is higher
+	 * than regular tasks, but not infinitely powerful.
+	 */
+	set_task_ioprio(current, IOPRIO_PRIO_VALUE(IOPRIO_CLASS_RT, 7));
+
+	/*
 	 * And now, wait forever for commit wakeup events.
 	 */
 	spin_lock(&journal->j_state_lock);
_


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-10/kernel.spec,v
retrieving revision 1.1309
retrieving revision 1.1310
diff -u -r1.1309 -r1.1310
--- kernel.spec	28 Mar 2009 01:07:26 -0000	1.1309
+++ kernel.spec	28 Mar 2009 01:38:24 -0000	1.1310
@@ -670,6 +670,9 @@
 # make relatime the default: do not apply this one yet
 Patch2922: fs-relatime-make-default.patch
 
+# fix stalls with ext3 data writeout
+Patch2950: linux-2.6-kjournald-use-rt-io-priority.patch
+
 Patch3000: linux-2.6-btrfs-experimental-branch.patch
 
 Patch9000: squashfs3.patch
@@ -1107,6 +1110,8 @@
 # don't apply this one yet
 #ApplyPatch fs-relatime-make-default.patch
 
+ApplyPatch linux-2.6-kjournald-use-rt-io-priority.patch
+
 
 # ext4
 # data integrity band-aid for badly written apps
@@ -1805,6 +1810,9 @@
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Fri Mar 27 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29-10
+- Change kjournald to real-time priority to avoid stalls in ext3.
+
 * Fri Mar 27 2009 Chuck Ebbert <cebbert at redhat.com> 2.6.29-9
 - Copy btrfs update from F11.
 




More information about the fedora-extras-commits mailing list