Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-stetsenko committed Jan 31, 2025
1 parent 290b43d commit df0f73b
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ static taskq_t *arc_flush_taskq;
* 1 (disabled) one thread - parallel eviction is disabled.
* 2+ (manual) set the number manually, limited by zfs_arc_evict_threads_max.
*/
static uint_t zfs_arc_evict_threads = 1;
static uint_t zfs_arc_evict_threads = 0;

/*
* The number of allocated ARC eviction threads. This limits the maximum value
Expand Down Expand Up @@ -4126,6 +4126,7 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
uint_t nthreads = (arc_evict_taskq == NULL ? 1 : MIN(num_sublists,
(zfs_arc_evict_threads == 0 ? zfs_arc_evict_threads_max :
MIN(zfs_arc_evict_threads, zfs_arc_evict_threads_max))));
nthreads = zfs_arc_evict_threads_max; /* XXX: */

boolean_t use_evcttq = nthreads > 1;

Expand All @@ -4152,12 +4153,17 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,

if (use_evcttq) {
evarg = kmem_alloc(sizeof (*evarg) * nthreads, KM_NOSLEEP);
/*
* Fall back to the regular single evict if it is not possible
* to allocate memory for the task queue entries.
*/
if (evarg == NULL)
if (evarg) {
for (int i = 0; i < nthreads; i++)
taskq_init_ent(&evarg[i].tqe);
} else {
/*
* Fall back to the regular single evict if it is not
* possible to allocate memory for the taskq entries.
*/
use_evcttq = B_FALSE;
}

}

/*
Expand All @@ -4176,14 +4182,18 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
if (left == ARC_EVICT_ALL) {
evict = left;
ntasks = nthreads;
/*
} else if (left > nthreads * MIN_EVICT_SIZE) {

Check failure on line 4186 in module/zfs/arc.c

View workflow job for this annotation

GitHub Actions / checkstyle

improper block comment
evict = DIV_ROUND_UP(left, nthreads);

Check failure on line 4187 in module/zfs/arc.c

View workflow job for this annotation

GitHub Actions / checkstyle

improper block comment
ntasks = nthreads;

Check failure on line 4188 in module/zfs/arc.c

View workflow job for this annotation

GitHub Actions / checkstyle

improper block comment
*/

Check failure on line 4189 in module/zfs/arc.c

View workflow job for this annotation

GitHub Actions / checkstyle

improper block comment close
} else {
evict = MIN_EVICT_SIZE;
ntasks = DIV_ROUND_UP(left, MIN_EVICT_SIZE);
//ntasks = DIV_ROUND_UP(left, MIN_EVICT_SIZE);

Check failure on line 4192 in module/zfs/arc.c

View workflow job for this annotation

GitHub Actions / checkstyle

missing blank after start comment
ntasks = nthreads;
}
} else {
ASSERT(0); /* XXX: */
ntasks = num_sublists;
evict = left;
}
Expand All @@ -4204,16 +4214,15 @@ arc_evict_state(arc_state_t *state, arc_buf_contents_t type, uint64_t spa,
sublist_idx = 0;

if (use_evcttq) {
taskq_init_ent(&evarg[i].tqe);
evarg[i].ml = ml;
evarg[i].marker = markers[sublist_idx];
evarg[i].spa = spa;
evarg[i].idx = sublist_idx;
evarg[i].bytes = evict;

taskq_dispatch_ent(arc_evict_taskq,
arc_evict_task,
&evarg[i], 0, &evarg[i].tqe);
arc_evict_task, &evarg[i], 0,
&evarg[i].tqe);
continue;
}

Expand Down Expand Up @@ -7996,6 +8005,7 @@ arc_init(void)
zfs_arc_evict_threads_max = max_ncpus / 2;
}

zfs_arc_evict_threads_max = 4; /* XXX: */
if (zfs_arc_evict_threads_max > 1) {
arc_evict_taskq = taskq_create("arc_evict",
zfs_arc_evict_threads_max,
Expand Down

0 comments on commit df0f73b

Please sign in to comment.