aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorDavid Chinner <dgc@sgi.com>2008-02-04 20:13:32 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 02:22:51 -0500
commit249a8c1124653fa90f3a3afff869095a31bc229f (patch)
treee0681990b5b61155a64a9fd3c0cf73d4d6bb4ce5 /fs/xfs/linux-2.6
parent4576758db5817a91b8974c696247d459dc653db2 (diff)
[XFS] Move AIL pushing into it's own thread
When many hundreds to thousands of threads all try to do simultaneous transactions and the log is in a tail-pushing situation (i.e. full), we can get multiple threads walking the AIL list and contending on the AIL lock. The AIL push is, in effect, a simple I/O dispatch algorithm complicated by the ordering constraints placed on it by the transaction subsystem. It really does not need multiple threads to push on it - even when only a single CPU is pushing the AIL, it can push the I/O out far faster that pretty much any disk subsystem can handle. So, to avoid contention problems stemming from multiple list walkers, move the list walk off into another thread and simply provide a "target" to push to. When a thread requires a push, it sets the target and wakes the push thread, then goes to sleep waiting for the required amount of space to become available in the log. This mechanism should also be a lot fairer under heavy load as the waiters will queue in arrival order, rather than queuing in "who completed a push first" order. Also, by moving the pushing to a separate thread we can do more effectively overload detection and prevention as we can keep context from loop iteration to loop iteration. That is, we can push only part of the list each loop and not have to loop back to the start of the list every time we run. This should also help by reducing the number of items we try to lock and/or push items that we cannot move. Note that this patch is not intended to solve the inefficiencies in the AIL structure and the associated issues with extremely large list contents. That needs to be addresses separately; parallel access would cause problems to any new structure as well, so I'm only aiming to isolate the structure from unbounded parallelism here. SGI-PV: 972759 SGI-Modid: xfs-linux-melb:xfs-kern:30371a Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 70024a24692d..156a1a7da16b 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -51,6 +51,7 @@
51#include "xfs_vfsops.h" 51#include "xfs_vfsops.h"
52#include "xfs_version.h" 52#include "xfs_version.h"
53#include "xfs_log_priv.h" 53#include "xfs_log_priv.h"
54#include "xfs_trans_priv.h"
54 55
55#include <linux/namei.h> 56#include <linux/namei.h>
56#include <linux/init.h> 57#include <linux/init.h>
@@ -765,6 +766,64 @@ xfs_blkdev_issue_flush(
765 blkdev_issue_flush(buftarg->bt_bdev, NULL); 766 blkdev_issue_flush(buftarg->bt_bdev, NULL);
766} 767}
767 768
769/*
770 * XFS AIL push thread support
771 */
772void
773xfsaild_wakeup(
774 xfs_mount_t *mp,
775 xfs_lsn_t threshold_lsn)
776{
777 mp->m_ail.xa_target = threshold_lsn;
778 wake_up_process(mp->m_ail.xa_task);
779}
780
781int
782xfsaild(
783 void *data)
784{
785 xfs_mount_t *mp = (xfs_mount_t *)data;
786 xfs_lsn_t last_pushed_lsn = 0;
787 long tout = 0;
788
789 while (!kthread_should_stop()) {
790 if (tout)
791 schedule_timeout_interruptible(msecs_to_jiffies(tout));
792 tout = 1000;
793
794 /* swsusp */
795 try_to_freeze();
796
797 ASSERT(mp->m_log);
798 if (XFS_FORCED_SHUTDOWN(mp))
799 continue;
800
801 tout = xfsaild_push(mp, &last_pushed_lsn);
802 }
803
804 return 0;
805} /* xfsaild */
806
807int
808xfsaild_start(
809 xfs_mount_t *mp)
810{
811 mp->m_ail.xa_target = 0;
812 mp->m_ail.xa_task = kthread_run(xfsaild, mp, "xfsaild");
813 if (IS_ERR(mp->m_ail.xa_task))
814 return -PTR_ERR(mp->m_ail.xa_task);
815 return 0;
816}
817
818void
819xfsaild_stop(
820 xfs_mount_t *mp)
821{
822 kthread_stop(mp->m_ail.xa_task);
823}
824
825
826
768STATIC struct inode * 827STATIC struct inode *
769xfs_fs_alloc_inode( 828xfs_fs_alloc_inode(
770 struct super_block *sb) 829 struct super_block *sb)