Over the years the default values for the taskqs used on Linux have
differed slightly from illumos. In the vast majority of cases this
was done to avoid creating an obnoxious number of idle threads which
would pollute the process listing.
With the addition of support for dynamic taskqs all multi-threaded
queues should be created as dynamic taskqs. This allows us to get
the best of both worlds.
* The illumos default values for the I/O pipeline can be restored.
These values are known to work well for most workloads. The only
exception is the zio write interrupt taskq which is changed to
ZTI_P(12, 8). At least under Linux more threads has been shown
to improve performance, see commit
7e55f4e.
* Reduces the number of idle threads on the system when it's not
under heavy load. The maximum number of threads will only be
created when they are required.
* Remove the vdev_file_taskq and rely on the system_taskq instead
which is now dynamic and may have up to 64-threads. Again this
brings us back inline with upstream.
* Tasks dispatched with taskq_dispatch_ent() are allowed to use
dynamic taskqs. The Linux taskq implementation supports this.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tim Chase <tim@chase2k.com>
Closes #3507
#ifndef _SYS_VDEV_FILE_H
#define _SYS_VDEV_FILE_H
-
-
#include <sys/vdev.h>
#ifdef __cplusplus
vnode_t *vf_vnode;
} vdev_file_t;
-extern void vdev_file_init(void);
-extern void vdev_file_fini(void);
-
#ifdef __cplusplus
}
#endif
taskq_ent_t *t)
{
ASSERT(func != NULL);
- ASSERT(!(tq->tq_flags & TASKQ_DYNAMIC));
/*
* Mark it as a prealloc'd task. This is important
bzero(&arc_eviction_hdr, sizeof (arc_buf_hdr_t));
arc_prune_taskq = taskq_create("arc_prune", max_ncpus, minclsyspri,
- max_ncpus, INT_MAX, TASKQ_PREPOPULATE);
+ max_ncpus, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
arc_ksp = kstat_create("zfs", 0, "arcstats", "misc", KSTAT_TYPE_NAMED,
sizeof (arc_stats) / sizeof (kstat_named_t), KSTAT_FLAG_VIRTUAL);
cv_init(&dp->dp_spaceavail_cv, NULL, CV_DEFAULT, NULL);
dp->dp_iput_taskq = taskq_create("z_iput", max_ncpus, minclsyspri,
- max_ncpus * 8, INT_MAX, TASKQ_PREPOPULATE);
+ max_ncpus * 8, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
return (dp);
}
mg->mg_activation_count = 0;
mg->mg_taskq = taskq_create("metaslab_group_taskq", metaslab_load_pct,
- minclsyspri, 10, INT_MAX, TASKQ_THREADS_CPU_PCT);
+ minclsyspri, 10, INT_MAX, TASKQ_THREADS_CPU_PCT | TASKQ_DYNAMIC);
return (mg);
}
const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = {
/* ISSUE ISSUE_HIGH INTR INTR_HIGH */
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* NULL */
- { ZTI_N(8), ZTI_NULL, ZTI_BATCH, ZTI_NULL }, /* READ */
- { ZTI_BATCH, ZTI_N(5), ZTI_N(16), ZTI_N(5) }, /* WRITE */
- { ZTI_P(4, 8), ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* FREE */
+ { ZTI_N(8), ZTI_NULL, ZTI_P(12, 8), ZTI_NULL }, /* READ */
+ { ZTI_BATCH, ZTI_N(5), ZTI_P(12, 8), ZTI_N(5) }, /* WRITE */
+ { ZTI_P(12, 8), ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* FREE */
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* CLAIM */
{ ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, /* IOCTL */
};
uint_t count = ztip->zti_count;
spa_taskqs_t *tqs = &spa->spa_zio_taskq[t][q];
char name[32];
- uint_t i, flags = 0;
+ uint_t i, flags = TASKQ_DYNAMIC;
boolean_t batch = B_FALSE;
if (mode == ZTI_MODE_NULL) {
dmu_init();
zil_init();
vdev_cache_stat_init();
- vdev_file_init();
zfs_prop_init();
zpool_prop_init();
zpool_feature_init();
spa_evict_all();
- vdev_file_fini();
vdev_cache_stat_fini();
zil_fini();
dmu_fini();
* Commit callback taskq hasn't been created yet.
*/
tx->tx_commit_cb_taskq = taskq_create("tx_commit_cb",
- 100, minclsyspri, max_ncpus, INT_MAX,
- TASKQ_THREADS_CPU_PCT | TASKQ_PREPOPULATE);
+ max_ncpus, minclsyspri, max_ncpus, max_ncpus * 2,
+ TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
}
cb_list = kmem_alloc(sizeof (list_t), KM_SLEEP);
* Virtual device vector for files.
*/
-static taskq_t *vdev_file_taskq;
-
static void
vdev_file_hold(vdev_t *vd)
{
* the sync must be dispatched to a different context.
*/
if (spl_fstrans_check()) {
- VERIFY3U(taskq_dispatch(vdev_file_taskq,
+ VERIFY3U(taskq_dispatch(system_taskq,
vdev_file_io_fsync, zio, TQ_SLEEP), !=, 0);
return;
}
return;
}
- VERIFY3U(taskq_dispatch(vdev_file_taskq, vdev_file_io_strategy, zio,
+ VERIFY3U(taskq_dispatch(system_taskq, vdev_file_io_strategy, zio,
TQ_SLEEP), !=, 0);
}
B_TRUE /* leaf vdev */
};
-void
-vdev_file_init(void)
-{
- vdev_file_taskq = taskq_create("vdev_file_taskq", 100, minclsyspri,
- max_ncpus, INT_MAX, TASKQ_PREPOPULATE | TASKQ_THREADS_CPU_PCT);
-
- VERIFY(vdev_file_taskq);
-}
-
-void
-vdev_file_fini(void)
-{
- taskq_destroy(vdev_file_taskq);
-}
-
/*
* From userland we access disks just like files.
*/
mutex_init(&zvol_state_lock, NULL, MUTEX_DEFAULT, NULL);
zvol_taskq = taskq_create(ZVOL_DRIVER, zvol_threads, maxclsyspri,
- zvol_threads, INT_MAX, TASKQ_PREPOPULATE);
+ zvol_threads * 2, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
if (zvol_taskq == NULL) {
printk(KERN_INFO "ZFS: taskq_create() failed\n");
error = -ENOMEM;