Skip to content

Commit

Permalink
Reduce number of arc_prune threads.
Browse files Browse the repository at this point in the history
On FreeBSD vnode reclamation is single-threaded, protected by single
global lock.  Having more threads there is just a waste of resources,
so reduce it to one.

Linux uses 1-2 threads per mount point, but even if it can scale
that far, I doubt it makes sense to use all CPUs for it same time,
so limit it to 80% alike to batch ZIO taskqs.

Signed-off-by: Alexander Motin <mav@FreeBSD.org>
  • Loading branch information
amotin committed Dec 21, 2021
1 parent 3fa5266 commit 12ff01d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion module/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7983,7 +7983,12 @@ arc_init(void)
offsetof(arc_prune_t, p_node));
mutex_init(&arc_prune_mtx, NULL, MUTEX_DEFAULT, NULL);

arc_prune_taskq = taskq_create("arc_prune", 100, defclsyspri,
#ifdef __FreeBSD__
percent = 0; /* More than one thread makes no sense. */
#else
percent = 80; /* Can use 1-2 threads per mount point. */
#endif
arc_prune_taskq = taskq_create("arc_prune", percent, defclsyspri,
boot_ncpus, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC |
TASKQ_THREADS_CPU_PCT);

Expand Down

0 comments on commit 12ff01d

Please sign in to comment.