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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC54BC001DF for ; Thu, 3 Aug 2023 18:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235379AbjHCSFB (ORCPT ); Thu, 3 Aug 2023 14:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbjHCSEo (ORCPT ); Thu, 3 Aug 2023 14:04:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FD94686; Thu, 3 Aug 2023 11:03:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D57161E69; Thu, 3 Aug 2023 18:02:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6764C433C9; Thu, 3 Aug 2023 18:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691085728; bh=JGVnC0J1SM2pfWRkhkzwGN7FQbV5LL71nVPTYha/bKc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KOzdS3qr4/0+WpRbAleMWXu4JXfsMV6P9uaMoFcuDF6NdGo9NRD3JLYIOhuDmcS4C MrVbW5/3s9aMHkDV5QBSsVmgZx0NSJNYc/T2SphRC7S8Ez2e+ffQdtyp/l8ZqvprZX ZEs9ztLDUKfPKuSK1QJ7eLavxVvWDpy5/KV71g8Ie+o16XJgjqHkcZizmkEtrbeaMJ XX7mwzLUWxCCcjuwrPI0NSz9h8wXI5G3NNo9CJOfhTOmL4MQXR7PvFH8PJDH5/CAHt uRTWcZU+SMnxk6MAVd82aMi5gEa0XJQ/Ysf9ipX3pUcnOhgHwmWDciZDeluX10QIoG iiVpJ1h8eB9qQ== Date: Thu, 3 Aug 2023 20:02:03 +0200 From: Christian Brauner To: Linus Torvalds Cc: Mateusz Guzik , Jens Axboe , Christoph Hellwig , Aleksa Sarai , Al Viro , Seth Forshee , linux-fsdevel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] file: always lock position Message-ID: <20230803-libellen-klebrig-0a9e19dfa7dd@brauner> References: <20230724-vfs-fdget_pos-v1-1-a4abfd7103f3@kernel.org> <20230724-pyjama-papier-9e4cdf5359cb@brauner> <20230803095311.ijpvhx3fyrbkasul@f> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Aug 03, 2023 at 08:45:54AM -0700, Linus Torvalds wrote: > On Thu, 3 Aug 2023 at 02:53, Mateusz Guzik wrote: > > > > So yes, atomics remain expensive on x86-64 even on a very moden uarch > > and their impact is measurable in a syscall like read. > > Well, a patch like this should fix it. > > I intentionally didn't bother with the alpha osf version of readdir, > because nobody cares, but I guess we could do this in the header too. > > Or we could have split the FMODE_ATOMIC_POS bit into two, and had a > "ALWAYS" version and a regular version, but just having a > "fdget_dir()" made it simpler. > > So this - together with just reverting commit 20ea1e7d13c1 ("file: > always lock position for FMODE_ATOMIC_POS") - *should* fix any > performance regression. > > But I have not tested it at all. So.... Yeah, this is my suggestion - and your earlier suggestion - in the thread. Only thing that's missing is exclusion with seek on directories as that's the heinous part.