From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from e3i421.smtp2go.com (e3i421.smtp2go.com [158.120.85.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71B11340404 for ; Wed, 20 May 2026 19:19:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=158.120.85.165 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779304749; cv=none; b=nWlKj0Y1kMxJ+174T5R7EbkCo5t4iRC5zv+x//AQKnOOMDKnI1wQjvDwvVigBOhCqKOwJa4d3+AXgyMQNod1a2kbKO6cVPdOqJGOw1/S7ZZ3fhPBIQYjuuXViZh1kMUORTUhmSzbgmTOHX08GN/EUC2lFJOMAE7EpwQ56kfARY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779304749; c=relaxed/simple; bh=DDN6XDxvcCU5fDxCWpLEYG53qrXGdlsJY1qCyYZeB10=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ERkOK667xgF1q437cQ7KcJIqPqDT5OT4cigNAwdNpMqMr/sJfjUXIsWIGYQSj8B8s6EUDpdGvYeRtOGFSNEsIeO6AEhfpgHDut/2LuDaw0Q0xyj1PJ4yqC0KNDT2EPXdF13KbumiG79UygMPzzf4TMAkAkxLVjNW1ghqRKzKE4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=triplefau.lt; spf=pass smtp.mailfrom=em510616.triplefau.lt; dkim=pass (2048-bit key) header.d=triplefau.lt header.i=@triplefau.lt header.b=Gwx8xo2V; arc=none smtp.client-ip=158.120.85.165 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=triplefau.lt Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=em510616.triplefau.lt Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=triplefau.lt header.i=@triplefau.lt header.b="Gwx8xo2V" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=triplefau.lt; i=@triplefau.lt; q=dns/txt; s=s510616; t=1779303841; h=from : subject : to : message-id : date; bh=LVAjlRvJ0GkGfrBEy8PvqJhPIKXbAVEbrDEErYfGT1g=; b=Gwx8xo2VQw+r+uSlkh17dVAo4z1Wq6IRD/SIsuC328KsmU/XS0ZHAMPwbyhjV0z6BUzqm FWh7TRN0sodfKo1uR1B+0WoSAzhuOHCGxETbe66O2AmxNtmi+qwdkypb2z8gOV4rrA40Hvx xLtoGGPXyVFG26Zhe7RTrF/1Wygqdm9z1ouIcyxLFeTadz1Xc8U7xoauToD+gh7Ucbz01hi hiqcEgmViCPvBdEnLmhUTN37xKi/5VAUV9uXBmZ+Wi1yNasUq2efmFwae6dc7pNJYLR9Jit kQj8yKcDPeaJAifb+Ao+iQdNc0ESFXYysgfA6YJ4LpidKO8rhLtomkMCVe2Q== Received: from [10.12.239.196] (helo=localhost) by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.99.2) (envelope-from ) id 1wPmCr-4o5NDgrlNh0-l1sw; Wed, 20 May 2026 19:03:49 +0000 From: Remi Pommarel To: v9fs@lists.linux.dev Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , Remi Pommarel Subject: [PATCH v6 0/4] 9p: Performance improvements for build workloads Date: Wed, 20 May 2026 20:41:36 +0200 Message-ID: X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Report-Abuse: Please forward a copy of this message, including all headers, to Feedback-ID: 510616m:510616apGKSTK:510616s2udruuJ1Q X-smtpcorp-track: IA4oBqtmW6w_.pIta7NfBFoIJ.wdAspw0BrZS This patchset introduces several performance optimizations for the 9p filesystem when used with cache=loose option (exclusive or read only mounts). These improvements particularly target workloads with frequent lookups of non-existent paths and repeated symlink resolutions. The very state of the art benchmark consisting of cloning a fresh hostap repository and building hostapd and wpa_supplicant for hwsim tests (cd tests/hwsim; time ./build.sh) in a VM running on a 9pfs rootfs (with trans=virtio,cache=loose options) has been used to test those optimizations impact. For reference, the build takes 0m56.492s on my laptop natively while it completes in 2m18.702sec on the VM. This represents a significant performance penalty considering running the same build on a VM using a virtiofs rootfs (with "--cache always" virtiofsd option) takes around 1m32.141s. This patchset aims to bring the 9pfs build time close to that of virtiofs, rather than the native host time, as a realistic expectation. This first three patches in this series focus on keeping negative dentries in the cache, ensuring that subsequent lookups for paths known to not exist do not require redundant 9P RPC calls. This optimization reduces the time needed for the compiler to search for header files across known locations. The two first patches introduce a new mount option, ndentrycache, which specifies the number of ms to keep the dentry in the cache. Using ndentrycache without value (i.e. keeping the negative dentry indifinetly) shrunk build time to 1m46.198s. The third patch enable the negative dentry caching for 24 hours by default on cache=loose. The fourth patch extends page cache usage to symlinks by allowing p9_client_readlink() results to be cached. Resolving symlink is apparently something done quite frequently during the build process and avoiding the cost of a 9P RPC call round trip for already known symlinks helps reduce the build time to 1m26.602s, outperforming the virtiofs setup. Here is summary of the different hostapd/wpa_supplicant build times: - Baseline (no patch): 2m18.702s - negative dentry caching (patches 1-3): 1m46.198s (23% improvement) - Above + symlink caching (patches 1-4): 1m26.302s (an additional 18% improvement, 37% in total) With this ~37% performance gain, 9pfs with cache=loose can compete with virtiofs for (at least) this specific scenario. Although this benchmark is not the most typical, I do think that these caching optimizations could benefit a wide range of other workflows as well. Changes since v5 (address relevant sashiko.dev remarks): - Replace forgotten ndentrycache with negtimeout wording in documentation - Rework v9fs_issue_read() to perform proper offset and length validation, remove PAGE_SIZE truncation, and use the actual copied length rather than the expected one. - Use d_find_any_alias() instead of d_find_alias() to avoid unhashed dentry race in v9fs_init_request(). Changes since v4: - Fix potential uninitialized access in v9fs_issue_read() and v9fs_vfs_symlink_dotl() - Fix potential memory leak in v9fs_issue_read() Changes since v3: - Go back to s32 ndentry timeout option, rename it to negtimeout so its easier to grep - Bring back the missing 4 letters for *_TIMEOUT_* macro name - Fix some alignment/space issues Changes since v2: - Rename v9fs_dentry_is_{expired,refresh} to ndentry - Some grammatical fixes in couple of comments - Rename the negative cache mount option to ndentrycache. Using ndentrycache without value enable infinite caching while ndentrycache=