From 55f83631eb2382113950d855c8ee29dce6827b79 Mon Sep 17 00:00:00 2001 From: Kevin Jin <33590050+jxdking@users.noreply.github.com> Date: Tue, 16 Jan 2024 13:13:31 -0500 Subject: [PATCH] Autotrim High CPU Usage Fix Switch from cv_wait() to cv_wait_idle() inside vdev_autotrim_wait_kick(), which should mitigate the high CPU usage while waiting. Signed-off-by: jxdking --- module/zfs/vdev_trim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/vdev_trim.c b/module/zfs/vdev_trim.c index 1c54eae40355..278a69f39588 100644 --- a/module/zfs/vdev_trim.c +++ b/module/zfs/vdev_trim.c @@ -196,7 +196,7 @@ vdev_autotrim_wait_kick(vdev_t *vd, int num_of_kick) for (int i = 0; i < num_of_kick; i++) { if (vd->vdev_autotrim_exit_wanted) break; - cv_wait(&vd->vdev_autotrim_kick_cv, &vd->vdev_autotrim_lock); + cv_wait_idle(&vd->vdev_autotrim_kick_cv, &vd->vdev_autotrim_lock); } boolean_t exit_wanted = vd->vdev_autotrim_exit_wanted; mutex_exit(&vd->vdev_autotrim_lock);