From nobody Wed Jan 10 06:20:54 2024 X-Original-To: fs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T8yNQ6Z7Xz564Kt for ; Wed, 10 Jan 2024 06:20:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T8yNQ4Wgsz4fKC for ; Wed, 10 Jan 2024 06:20:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704867654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W/esXBAVjGHIUy3HSar19hemwl9jPxS4CA2fUfjmiKo=; b=Q0AOu7I/K4mwJDXW8VMWP7hXETb0zlbTlHtOaStm0TMCEtM6jJohS0Tz5ba54T8G2S8z24 apVBRn/10q2XPep21T1J23shFuzksyd6Sbbqbqrxe1obWzhh3W0kZvqCE2H2yNEHq/XJzk eVNcIOuTcK0Ea7ptIQfBa/m1jS177WoyTrrPWtjMDm3vr9tS/gCegI/qH8NGzqaV6XNQpi n8NXu7gx5cBQy7Ij1KX07p91M71uL7GWEeMJzeQqgAQCcqSYMN4xMRpMYUkcO5DqPvtnS0 yDVn7wKbo2bar9vzUTJgnZxLjm/T3pRl4UB4fL+aijYw8T990infZLr/f/rI3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704867654; a=rsa-sha256; cv=none; b=qn0Irm/HxGhNneUfVStBMVLiZ6IdQ+E85FqXKwsGm+0hEZjaXlad/JDVo+O65CVeVMv/Kd qpzI04njGRgea6c2S8BtfD0nFqpN08pabtcAJpSTc8r9WmTuARwQvtgxwzsoDAshRmAO0v pm2XBUisg+y/yYy7wLIWeWpGKFjuAoiiUYhxCwRg15Io+SL3jNwfpwFtZR2QIOKCKG9WXZ nI1URmMssi8h0eyBzISUrSF0v9OFy6LbND37OVKt7W/9PvePm0PzukACaRiw72so4T/X3l Or/+v+lymPmwGlamTAtgRxDUoFEvM7bjEKgbeSFJQygIpDpLZ44gZIdRqAMFQw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T8yNQ3bmbzP1l for ; Wed, 10 Jan 2024 06:20:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 40A6KsJ7090376 for ; Wed, 10 Jan 2024 06:20:54 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 40A6KsUl090343 for fs@FreeBSD.org; Wed, 10 Jan 2024 06:20:54 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: fs@FreeBSD.org Subject: [Bug 275594] High CPU usage by arc_prune; analysis and fix Date: Wed, 10 Jan 2024 06:20:54 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: seigo.tanimura@gmail.com X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: fs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275594 --- Comment #28 from Seigo Tanimura --- (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.=