@@ -4089,7 +4089,7 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
4089
4089
arc_buf_hdr_t * * markers ;
4090
4090
unsigned num_sublists = multilist_get_num_sublists (ml );
4091
4091
evict_arg_t * evarg ;
4092
- boolean_t usetskq = zfs_arc_evict_threads_live > 1 ;
4092
+ boolean_t useevicttaskq = zfs_arc_evict_threads_live > 1 ;
4093
4093
4094
4094
if (bytes == 0 )
4095
4095
return (total_evicted );
@@ -4115,14 +4115,14 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
4115
4115
multilist_sublist_unlock (mls );
4116
4116
}
4117
4117
4118
- if (usetskq ) {
4118
+ if (useevicttaskq ) {
4119
4119
evarg = kmem_alloc (sizeof (* evarg ) * num_sublists , KM_NOSLEEP );
4120
4120
/*
4121
4121
* Fall back to the regular single evict if it is not possible
4122
4122
* to allocate memory for the task queue entries.
4123
4123
*/
4124
4124
if (evarg == NULL )
4125
- usetskq = B_FALSE ;
4125
+ useevicttaskq = B_FALSE ;
4126
4126
}
4127
4127
4128
4128
/*
@@ -4204,7 +4204,7 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
4204
4204
if (sublist_idx >= num_sublists )
4205
4205
sublist_idx = 0 ;
4206
4206
4207
- if (usetskq ) {
4207
+ if (useevicttaskq ) {
4208
4208
uint64_t evict = i < k ? bytes_pertask :
4209
4209
bytes_pertask_low ;
4210
4210
@@ -4234,7 +4234,7 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
4234
4234
total_evicted += bytes_evicted ;
4235
4235
}
4236
4236
4237
- if (usetskq ) {
4237
+ if (useevicttaskq ) {
4238
4238
taskq_wait (arc_evict_taskq );
4239
4239
total_evicted += scan_evicted ;
4240
4240
}
@@ -4263,7 +4263,7 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
4263
4263
}
4264
4264
}
4265
4265
4266
- if (usetskq )
4266
+ if (useevicttaskq )
4267
4267
kmem_free (evarg , sizeof (* evarg ) * num_sublists );
4268
4268
4269
4269
for (int i = 0 ; i < num_sublists ; i ++ ) {
@@ -7819,6 +7819,7 @@ arc_set_limits(uint64_t allmem)
7819
7819
void
7820
7820
arc_init (void )
7821
7821
{
7822
+ boolean_t useevicttaskq ;
7822
7823
uint64_t percent , allmem = arc_all_memory ();
7823
7824
mutex_init (& arc_evict_lock , NULL , MUTEX_DEFAULT , NULL );
7824
7825
list_create (& arc_evict_waiters , sizeof (arc_evict_waiter_t ),
@@ -7891,15 +7892,18 @@ arc_init(void)
7891
7892
MIN ((highbit64 (max_ncpus ) - 1 ) + max_ncpus / 64 , 16 );
7892
7893
else
7893
7894
zfs_arc_evict_threads_live = zfs_arc_evict_threads ;
7895
+ useevicttaskq = zfs_arc_evict_threads_live > 1 ;
7894
7896
7895
7897
list_create (& arc_prune_list , sizeof (arc_prune_t ),
7896
7898
offsetof(arc_prune_t , p_node ));
7897
7899
mutex_init (& arc_prune_mtx , NULL , MUTEX_DEFAULT , NULL );
7898
7900
7899
7901
arc_prune_taskq = taskq_create ("arc_prune" , zfs_arc_prune_task_threads ,
7900
7902
defclsyspri , 100 , INT_MAX , TASKQ_PREPOPULATE | TASKQ_DYNAMIC );
7901
- arc_evict_taskq = taskq_create ("arc_evict" , zfs_arc_evict_threads_live ,
7902
- defclsyspri , 0 , INT_MAX , TASKQ_PREPOPULATE );
7903
+ if (useevicttaskq )
7904
+ arc_evict_taskq = taskq_create ("arc_evict" ,
7905
+ zfs_arc_evict_threads_live , defclsyspri , 0 , INT_MAX ,
7906
+ TASKQ_PREPOPULATE );
7903
7907
7904
7908
arc_ksp = kstat_create ("zfs" , 0 , "arcstats" , "misc" , KSTAT_TYPE_NAMED ,
7905
7909
sizeof (arc_stats ) / sizeof (kstat_named_t ), KSTAT_FLAG_VIRTUAL );
@@ -7960,6 +7964,8 @@ arc_init(void)
7960
7964
void
7961
7965
arc_fini (void )
7962
7966
{
7967
+ boolean_t useevicttaskq = zfs_arc_evict_threads_live > 1 ;
7968
+
7963
7969
arc_prune_t * p ;
7964
7970
7965
7971
#ifdef _KERNEL
@@ -7974,8 +7980,10 @@ arc_fini(void)
7974
7980
arc_ksp = NULL ;
7975
7981
}
7976
7982
7977
- taskq_wait (arc_evict_taskq );
7978
- taskq_destroy (arc_evict_taskq );
7983
+ if (useevicttaskq ) {
7984
+ taskq_wait (arc_evict_taskq );
7985
+ taskq_destroy (arc_evict_taskq );
7986
+ }
7979
7987
7980
7988
taskq_wait (arc_prune_taskq );
7981
7989
taskq_destroy (arc_prune_taskq );
0 commit comments