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