From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52A6AD6392C for ; Wed, 20 Nov 2024 11:13:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E193A6B0085; Wed, 20 Nov 2024 06:13:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC81F6B0088; Wed, 20 Nov 2024 06:13:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C91296B0089; Wed, 20 Nov 2024 06:13:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AC6816B0085 for ; Wed, 20 Nov 2024 06:13:07 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 69B0B1C711F for ; Wed, 20 Nov 2024 11:13:07 +0000 (UTC) X-FDA: 82806208002.17.56846FD Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 318BC12000C for ; Wed, 20 Nov 2024 11:11:56 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tkcAN8OR; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732101001; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4S61WiJ6rhrEhOgWM0IVj1oUiUmeYH31GG0xUmvPUko=; b=4lOXQGTx3NT3+hzatSlpoakE5qauEhF+ybAqHu5gQa5M75gnrGVLr1HQoLuoBgSnHhE2sJ /ZD80hSyeAFVQO1+xsBzmV4NHTFhlboRiOtAkVjAwt6KMhpNbm6WqeWUfR1W7q7OsrjVhP 3NZq2MYXkdxb6rwADzmjTPluKo1huMQ= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tkcAN8OR; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732101001; a=rsa-sha256; cv=none; b=4eYLdLtfX3AySml19UpOphgtxnIywbB1VVhWPyZmjoQgUtmGQOy+yKZf1J/OxJGDOxyvCD MA2RsMmq1yO33Q0ejc/OQScrZeVYhSayjl/oCbXa2Zt4oucxnOJcHekLxW5CJbRKhkhI7g DkpG1gsNiKDdEg3B4NDr7vR/rxbAyLM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1DB005C5A1B; Wed, 20 Nov 2024 11:12:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27D68C4CECD; Wed, 20 Nov 2024 11:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732101184; bh=1tK3mNV1medkTsrWi5AOiq1g0g7TLImk9SIlS9oUxJg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tkcAN8ORF74aFH3WrhIEDG3ZIdnSG/SKW8//csuqj/WcsBLygQBVoNcBmyoCGxGlc 2A72KH31KkIJypBqxHI9U0Nxox229R9R6hVb4Pco2D1I28DGYpYSCWzW/LFt01qbT7 PmeTSCHkof9GvT1STlNmnavoSonRCupTOfca3V64uDCh/DBsc6btugI4hl/iiZfGgK 5hftA8xbK63wx/QfUA4sWwSCTd2iwaeRl2/2uL7bwCrYi4zmJXCxofkR3z/Pm+EOUJ YwGJ4VZx4Cka/mRiwdPe5pUFmCZziCl1FYrdbK7vLdaOv60la3lRAHTyLqFyU3mByo BotohyMqUeFyA== Date: Wed, 20 Nov 2024 12:12:59 +0100 From: Christian Brauner To: Mateusz Guzik Cc: viro@zeniv.linux.org.uk, jack@suse.cz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, hughd@google.com, linux-ext4@vger.kernel.org, tytso@mit.edu, linux-mm@kvack.org Subject: Re: [PATCH v2 0/3] symlink length caching Message-ID: <20241120-eisbahn-frost-824303fa16d9@brauner> References: <20241119094555.660666-1-mjguzik@gmail.com> <20241120-werden-reptil-85a16457b708@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 318BC12000C X-Stat-Signature: qm6xw4k7u76xfibn9t1aq3pga46emwny X-Rspam-User: X-HE-Tag: 1732101116-483561 X-HE-Meta: U2FsdGVkX194z9jOKTbIpWEhMarWIlHALPhH0SVlYUFzjEWmr7gYokdTNSK5uX3uQZ562rwIZLRWSuOW5f4T7+v95e4niuS7Gt/I+RQ/T1GotkWex71+omo1V5JcBslo9VJpykKvevtShDl6Mh1+BhQct2/j23myfJ2oKiqjX9WKVEncYHEtCEmKD1dPx9NtjZT4Dgr9G+DstiuzWLrxhaJ9+xrfqjdXsF66M3euxE+9e7aVHvC0JuuJBXok/4UQ1F6aBhwpsbiVmMpzcT8nulRqRh7Tn7xpkjGKWXNd259jwsLZSht9Q1mul3+A7pYQiL0iNljmmXNQqT7Iia0Lh8Pc8Mu75OKsPbyTQF1JU2pN3rxQQ7xud+oym6t6MeVc6JDtD0Z2vOUDZ01mevUd6kpCP5H660OZ1Z7ftuuUqEm6mc+TwHBJyWPGYHXyCYJhxxMIgdHcwEB+3tohia6PKbBRRBta8xzQi3inoXjU5yfYW5WoZ0HAoPD0TNtVJErOm3pvGi5XcOif6pUVUy/zmaCWyaHIP9ejVSRawBImD6p2JCxVbXMvRgkZj/9jHB3U7T5il8INnE85oZhM5uReHsJ8XZIwURYHA5us55qwTGY5zElJZ0kU+RtHV0b4NN53ofXUxKUXzl2wlPGmBDZLJRsxFAEPrDbRxrl4EhfTFaOgjgbkFYJkboXQ46pqSD9sQ+OEBk5IHHm2ZF8nSDzVaQaE1k+Tx+BAs8WCrMsgm6UEXZKh+/aosCVWp0xNx7sMCu1RkK8Uw9zJVP3Mc4ruC4fOWvPrpfb1C7OrjPW5Ts5Y8T1rwKx0JFa7K7Fao79kpmhQ9WwIqKIfPJvTchXCd5yyjYi86amh0ZTq+schDzk0ePq9ajYcwQrliVZkjaFPhgWJFW+9hLonHh3lTSccf7HkEeJXP7p2miXm284RWw42QfMVa0Y9fCzhAINL4udGx3SEH2Q7n0ppxzuOFva +Qftm1I5 fqJHPvKRm/y5PWHHfrQmUpWJfuHmhI3vnBaWJqSyos+EOVrJxh0Row3aaYI6QhRxSvDjY9x0Q1Mgkj8SjEuY4DTPXpLbAgzux3/9vA8ArJ05YVpK5Ax9mYXVeuZ9HnyAMxgtDk4SAkkzwnaF/E0oDWJ6pgdXT2Q2Xhrj2XOoHcEUhY4T+H7xTdJ/joMS1Odc9z+Gme3odBPvwgU7DSUf9YmerYb+XucKBO/D17ebz3xKkefT6RFnqFKqzkFb5AJWhKwvFJJ55F5oXSxF+AeHA9B17aBVFXgdLGH+/76yY7dAXPMM6mRc+rndewCaYZ94dJJuF++H3UAtik1OGthb1U1rUNSX2xf5oxSRb X-Bogosity: Ham, tests=bogofilter, spamicity=0.000068, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Nov 20, 2024 at 11:42:33AM +0100, Mateusz Guzik wrote: > On Wed, Nov 20, 2024 at 11:33 AM Christian Brauner wrote: > > > > On Tue, Nov 19, 2024 at 10:45:52AM +0100, Mateusz Guzik wrote: > > > quote: > > > When utilized it dodges strlen() in vfs_readlink(), giving about 1.5% > > > speed up when issuing readlink on /initrd.img on ext4. > > > > > > Benchmark code at the bottom. > > > > > > ext4 and tmpfs are patched, other filesystems can also get there with > > > some more work. > > > > > > Arguably the current get_link API should be patched to let the fs return > > > the size, but that's not a churn I'm interested into diving in. > > > > > > On my v1 Jan remarked 1.5% is not a particularly high win questioning > > > whether doing this makes sense. I noted the value is only this small > > > because of other slowdowns. > > > > The thing is that you're stealing one of the holes I just put into struct > > inode a cycle ago or so. The general idea has been to shrink struct > > inode if we can and I'm not sure that caching the link length is > > actually worth losing that hole. Otherwise I wouldn't object. > > > > Per the patch description this can be a union with something not used > for symlinks. I'll find a nice field. Ok! > > > > All that aside there is also quite a bit of branching and func calling > > > which does not need to be there (example: make vfsuid/vfsgid, could be > > > combined into one routine etc.). > > > > They should probably also be made inline functions and likely/unlikely > > sprinkled in there. > > someone(tm) should at least do a sweep through in-vfs code. for Yeah, in this case I was specifically talking about make_vfs{g,u}id(). They should be inlines and they should contain likely/unlikely. > example LOOKUP_IS_SCOPED is sometimes marked as unlikely and other > times has no annotations whatsoever, even though ultimately it all > executes in the same setting > > Interestingly even __read_seqcount_begin (used *twice* in path_init()) > is missing one. I sent a patch to fix it long time ago but the > recipient did not respond I snatched it.