[Bug 275594] High CPU usage by arc_prune; analysis and fix

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 31 Jan 2024 07:52:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275594

--- Comment #42 from Seigo Tanimura <seigo.tanimura@gmail.com> ---
(In reply to Thomas Mueller from comment #41)

Thank you so much and sorry for the delayed reply.  I now believe the fix works
on your case as well.

* Fix Status

I am now checking the ARC eviction and pruning triggered by the vm_lowmem
kernel event.  There was a case where the system stalled with pagedaemon{uma}
running at the WCPU of ~0.3% in the late stage of poudriere-bulk(8).  I suspect
that a pagedaemon thread put itself to the arc_evict_waiters list in
arc_wait_for_eviction(), called by arc_lowmem(), to handle the vm_lowmem kernel
event.  In such the case, the ARC pruning has to work more eagerly so that the
pagedaemon thread does not block forever.

The issue above has been confirmed experimentally by checking for the non-empty
arc_evict_waiters list in {arc,zfs}_prune_task().  Also, arc_lowmem() has the
lines for such the case.

> static void
> arc_lowmem(void *arg __unused, int howto __unused)
> {
> 	(snip)
> 	/*
> 	 * It is unsafe to block here in arbitrary threads, because we can come
> 	 * here from ARC itself and may hold ARC locks and thus risk a deadlock
> 	 * with ARC reclaim thread.
> 	 */
> 	if (curproc == pageproc)
> 		arc_wait_for_eviction(to_free, B_FALSE);
> }

After the current test, I will see if this issue can be worked out somehow.

-- 
You are receiving this mail because:
You are the assignee for the bug.