Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2173553rdh; Tue, 26 Sep 2023 15:08:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxLXankTDIocZm7JnVhcWoo2Q4JyJIAbOsrBN1jPwzqhfDXqU3RfFYf9qjKt2wU37sdUvl X-Received: by 2002:a05:6358:2791:b0:134:fdfc:4319 with SMTP id l17-20020a056358279100b00134fdfc4319mr418225rwb.20.1695766119041; Tue, 26 Sep 2023 15:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695766118; cv=none; d=google.com; s=arc-20160816; b=dqtkj2RWXd4txY/Q+MtXzn7R5VnJpICo6w7eX+NXc0hLdClZVSuFzKq74VagtyfwV+ 6A8wYyQdIQfzhIs/P7radId7pgeFPoK9IkCxUspgObA3ismNf7Jarc36mqmR0ekbuCMo EW9JxJKcs1LGaSpKoHy9lHnqFJJdVwgkFezbkV8DJyi9HLKbujlmja7p2hjjJnwEQ8aL M03VyUKMNx5o23xWcPnUHRal/d4Dup/yIiGSV9TRsFNECJwq6ZBbdfVQ6M1yzg7FFkk/ Sr1fvi6Ar+Wc/yOQT8HFkXyF9r/q+NuSteVLkhE48CqU7SUPjvJPmCxbpXGNC4Bcawia 4iiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=WU3qYtBinvT71w132QpbX+eOLkKeT0fUhf/6tkLATls=; fh=h0oLqIyvr9E5rIjILmCbzMWKw4UymhYoKBlPnUg6xD4=; b=u/hTrybXbMSHO3BFnPrqhVIhuOwJIPHto2n0OzIXTJKhrMFIdZ8zYh0VuFoo7O1BjU ipyEepxnM0PQSCg3xU/J7Uk/KpKOpAwCqhSAXun3doCjAbu5g2GMnvKpLY8A0YSeCxDA MREdzoh040V5TzfI0Az94iqqkxKH1wJZmvI+gZI6IzZ738vU8DDFzvZeFYh2VU9yo7Vl RQgdvbI13UmLhn81unlq9aCss/y6tYHaVf5wpewycMZ88tTcorm84MuJaP7lVZTJbGJq RxJR1iO6wkv80MkFD7PmIwo+hODeC4adfAJGGXOMjr5pC7+6zPbU0g8qLbzdbqEfig2H 4N/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l6TpI4TS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id c128-20020a633586000000b00584b3e195bdsi2917240pga.58.2023.09.26.15.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 15:08:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l6TpI4TS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D4313802DF30; Tue, 26 Sep 2023 08:40:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234564AbjIZPkn (ORCPT + 99 others); Tue, 26 Sep 2023 11:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234339AbjIZPkl (ORCPT ); Tue, 26 Sep 2023 11:40:41 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B1F710A; Tue, 26 Sep 2023 08:40:35 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3ae0135c4deso5344409b6e.3; Tue, 26 Sep 2023 08:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695742834; x=1696347634; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=WU3qYtBinvT71w132QpbX+eOLkKeT0fUhf/6tkLATls=; b=l6TpI4TSrCElg6GxvysUrz3K52U+QtTG/RvCYiJ0C3NKrjUoi2YTuR4ZjIRhEXaZxW 1vo8GE7NdFchOgO4DiPybAGqXYusnm16DlLcZ3I1m7H6d1c6rhSHPkoYAQVqdSTxGYuO YlrRoIoDjrLQeF1Be7oeRU0z3oieNEIR3AMzOkTWN0Fe81I3/IAkeI9FNgra/SvoKARR Il7cFXJ1ZSUnLplhM0upaBbeMUxf/k2+iGFhxz0LB87IThIqAytRLyCaADOq2pXaN36e jy/qwc3Kmp2lzPhPXmOHKjC9fLwi9AuvVnkYMpDAp1MxGcGi+YgQ3MtOnhkX+ecyGY1u 6wcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695742834; x=1696347634; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WU3qYtBinvT71w132QpbX+eOLkKeT0fUhf/6tkLATls=; b=ix+PegJ9jLrqhYt1937/WdsQOq/HKd26Zln28SIY/1Oy5RTSNh2IflAyVkrWows+9y iEnqIn9xVD/oIhVBI88PfdoadJj95x2NQJkm7gE5trjsExc5D4ElIjWVw2+HGPuJpUXF HJhQq2bCy0L1TqN2QGi9TfciKGzBs2BAo2hoLG1aWZ0XXjknVYf1RDtEgcrHhCXKswqS q+1dmCCfdD+T5OwjQbYMm6SuGnWZfpBy2l+UkydSYkUQ+aDaStvDNKEXGc7tjsxxbzHy 2WKFGAH0e2CLTJCLTLzj/BnxYXC61MRifPfpUzAxPGP9s7wsrUIIV5Oq/GUfP8ySeztT EXpQ== X-Gm-Message-State: AOJu0YwgQf9byBzJohObRKwuZ/7QH6glLcm9oJKWU4CIhdZ7sgm4rzcB VYYfz4aP+kxarotOUnRSjxRbtyEB3YeKz1dnDwz1LzH35qU= X-Received: by 2002:aca:f154:0:b0:3a7:3ea1:b5a0 with SMTP id p81-20020acaf154000000b003a73ea1b5a0mr11079342oih.47.1695742834290; Tue, 26 Sep 2023 08:40:34 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:5d4a:0:b0:4f0:1250:dd51 with HTTP; Tue, 26 Sep 2023 08:40:33 -0700 (PDT) In-Reply-To: <20230926-worum-angezapft-5c3f7770ad29@brauner> References: <20230925205545.4135472-1-mjguzik@gmail.com> <20230926-anforderungen-obgleich-47e465f0bd47@brauner> <20230926-worum-angezapft-5c3f7770ad29@brauner> From: Mateusz Guzik Date: Tue, 26 Sep 2023 17:40:33 +0200 Message-ID: Subject: Re: [PATCH] vfs: shave work on failed file open To: Christian Brauner Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, torvalds@linux-foundation.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 26 Sep 2023 08:40:42 -0700 (PDT) On 9/26/23, Christian Brauner wrote: >> > if (WARN_ON_ONCE(atomic_long_cmpxchg(&file->f_count, 1, 0) != 1)) { > >> bench again. > > Can you see how much of a difference it makes because imho it really > looks a lot nicer then this ugly atomic_read followed by atomic_set... > Huh, turns out to be in the noise here and I see why. Immediately following this there are several atomic ops anyway, notably to unref creds and apparmor labels. So happens top of the profile is the allocator(!). These can be fixed but that's perhaps for another time. If going this route then perhaps atomic_long_dec_and_test just like fput? Although one could argue if that cmpxchg failed then something fishy is going on and "real" fput would be safer. Ultimately there is a lot of handwaving possible whichever way, so just pick something and I'll send a v2. -- Mateusz Guzik