Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jan 2024 06:20:54 +0000
From:      bugzilla-noreply@freebsd.org
To:        fs@FreeBSD.org
Subject:   [Bug 275594] High CPU usage by arc_prune; analysis and fix
Message-ID:  <bug-275594-3630-WfWZyq5Z6Z@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-275594-3630@https.bugs.freebsd.org/bugzilla/>
References:  <bug-275594-3630@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275594

--- Comment #28 from Seigo Tanimura <seigo.tanimura@gmail.com> ---
(In reply to Seigo Tanimura from comment #22)

There was an implementation bug in the test of comment #22.  The updated
results with the bugfix attached.


* Sources on GitHub:

- Repo
  - https://github.com/altimeter-130ft/freebsd-freebsd-src
- Branches
  - Fix only
    - release/14.0.0/release-14_0_0-p2-topic-openzfs-arc_prune-regulation-f=
ix
  - Fix and counters
    -
release/14.0.0/release-14_0_0-p2-topic-openzfs-arc_prune-regulation-counters
  - The branches have been renamed to reflect the fix nature.
  - All of the commits in each branch have been squashed into one.
  - The commit logs have been revised into the style alike the release note=
s.
- Patches
  - Archive: openzfs-arc_prune-regulation-20240110.tar.xz
  - Each patch is named after its branch.


* Bugfix

- zfs_prune_task() passed the number of the dnodes to vnlru_free_vfsops() a=
nd
  hence vnlru_free_impl().
  - The ARC pruning may overcommit because there are genrally more dnodes t=
han
    znodes.
  - Fix: Convert the number of the dnodes into that of the znodes before
    passing it to vnlru_free_vfsops().
  - This bug is also found in the original source as well.


* Test results

Result Chart Archive (1 / 2): (poudriere-bulk-2024-01-09_10h19m59s.7z)

- zfs-znodes-and-dnodes.png
  - The counts of the ZFS znodes and dnodes.
- zfs-arc-pruning-regulation.png
  - The counts of the ARC prune triggers by ZFS and the skips by the fix.
- zfs-dnodes-and-freeing-activity.png
  - The freeing activity of the ZFS znodes and dnodes.
- vnode-free-calls.png
  - The calls to the ZFS vnode freeing functions.


Result Chart Archive (2 / 2): (poudriere-bulk-2024-01-09_10h19m59s-zfs-arc.=
7z)

- zfs-arc/zfs-arc-meta.png
  - The balancing of the ZFS ARC metadata and data.
- zfs-arc/zfs-arc-(A)-(B)-(C).png
  - The ZFS ARC stats.
    (A): MRU (mru) or MFU. (mfu)
    (B): Metadata (metadata) or data (data); the "ghost-" prefix denotes the
evicted cache.
    (C): Size (size) or hits (hits); the hits count the hit sizes, not the =
hit
counts.


Findings and Analysis:

- The giveups of vnlru_free_impl() dropped to virtually zero.
  - No CPU time was wasted for the effortless ARC pruning.
    - The logical bug has been fixed.
  - Some retries are inevitable in order to walk through the vnode list
completely.

- The actual ARC pruning execution is about 10K less than the requests.
  - Actual ARC pruning: < 100 / 10 mins.
  - Max ARC pruning requests: Order of 1M / 10 mins.
  - Regulation is essential to avoid the uncontrolled behaviour.

- Except for the transient time at the start and end of the build, the prun=
able
znodes stayed under 10% of the total znodes.
  - 10%: The default value of zfs_arc_dnode_reduce_percent.
  - The ARC pruning exhibited its best performance under the configured
limitation.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-275594-3630-WfWZyq5Z6Z>