diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2020-02-19 17:02:08 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2020-03-03 18:47:43 -0800 |
commit | c8575e80950676b4ed853e6680a2b808e87e8f92 (patch) | |
tree | d24a57cc516ca0478e7ae70a4b07229c40732084 /fs/xfs/xfs_super.c | |
parent | 6cc244b78522ea0de0d02576b014e948f92e3373 (diff) |
xfs: parallelize block preallocation garbage collectioneofblocks-consolidation_2020-03-03
Split the block preallocation garbage collection work into per-AG work
items so that we can take advantage of parallelization.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r-- | fs/xfs/xfs_super.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 9081663fcd31..c01f2f1666ad 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -479,7 +479,8 @@ xfs_init_mount_workqueues( goto out_destroy_cil; mp->m_blockgc_workqueue = alloc_workqueue("xfs-blockgc/%s", - WQ_MEM_RECLAIM|WQ_FREEZABLE, 0, mp->m_super->s_id); + WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_FREEZABLE, 0, + mp->m_super->s_id); if (!mp->m_blockgc_workqueue) goto out_destroy_reclaim; @@ -1341,6 +1342,25 @@ xfs_fc_validate_params( return 0; } +/* + * Constrain the number of threads that we start for background work. This + * is the estimated parallelism of the filesystem capped to the unbound work + * queue maximum. + * + * We can't set this when we allocate the workqueues because the thread count + * derives from AG count, and we can't know that until we're far enough through + * setup to read the superblock, which requires functioning workqueues. + */ +static inline void +xfs_configure_background_workqueues( + struct xfs_mount *mp) +{ + unsigned int max_active = xfs_guess_metadata_threads(mp); + + max_active = min_t(unsigned int, max_active, WQ_UNBOUND_MAX_ACTIVE); + workqueue_set_max_active(mp->m_blockgc_workqueue, max_active); +} + static int xfs_fc_fill_super( struct super_block *sb, @@ -1406,6 +1426,8 @@ xfs_fc_fill_super( if (error) goto out_free_sb; + xfs_configure_background_workqueues(mp); + error = xfs_setup_devices(mp); if (error) goto out_free_sb; @@ -1757,7 +1779,6 @@ static int xfs_init_fs_context( atomic_set(&mp->m_active_trans, 0); INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker); INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker); - INIT_DELAYED_WORK(&mp->m_blockgc_work, xfs_blockgc_worker); mp->m_kobj.kobject.kset = xfs_kset; /* * We don't create the finobt per-ag space reservation until after log |