Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp104340lqq; Wed, 12 Jun 2024 18:49:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWvtfrzlj8XQMasy1TfyNU686hjpENxunizogBcCpUWE9UPCgyTl/SLPl7bVH0hydLaeMLlC0s3iyP/LBUA6+Dn3jZ6BJXr46tj/bZgbg== X-Google-Smtp-Source: AGHT+IEL+tNqUTQg7Dg79WlL2LJy2UkWjM/ns65A9VfEh27ZNOjgIIUX+uhzBvk3JCHyj3DcCdlS X-Received: by 2002:a2e:9983:0:b0:2ea:e592:5bee with SMTP id 38308e7fff4ca-2ebfc9407d0mr18401061fa.29.1718243385371; Wed, 12 Jun 2024 18:49:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718243385; cv=pass; d=google.com; s=arc-20160816; b=0bO1ebiHDvFukNyq5Rplrg29A8osEDFs6R0CT5pOu5onksAxu6TRPTiSFYg/QzvUZd XA6+AhmZh1aywR7SP0uNSr6JjyxHojV5IhYhc2p7laC1Ta/Y+sFtS8sDTxzMEW4FCF2I yFyIa+J5lJl7Xr27KeyasEi+vqYaIL5T3MJd6IiKDYFW1ov20ksfWxHzrXeoCdtZ+kXh aTbEwaHyhlJyTvSskgeY9uQNROwUoBHTq0pvOLYSnMRcX0zCeyk8HYsWpynPDXdZNwzp 62nlbAxOyB4DJCqaaYvk+2ixuUDyKBebmn7XCfKSrGO/Di9LJF8IHPM5ZaOanXHZIuwb mfsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=u7oeDTF4u1EiwyzNNT5qA5Y4WKuC5XsAbUMmFlcK0R8=; fh=LIQZEy+49gSdpRVQbGakPyxaui92ZXpD9MHrNDVqBR4=; b=iqXE2c62GUZ89W40zJnBcxXeaHoIh+BBRZaOUPu28ZVzlKWr0OPLg8xnT4tbaApDbZ 1fK8f1GuoOQsT21RbGeD7zG9BCXJO6P3w+qXtTvM4NIw/v/BnF4dGhKMXZS3pt06Q8E1 mj9SaUla6P7QIPsqnAhekFVv1Z94AkTuZ67jtUQdY29ZyUkQC/S8KiR1wurPUVxYbcNv POiLbe+C28tMOB+W4/DKJiBk4aiqxizcwYM7VukivKqeh4hnPrHO8cVywjj6+67OOEJT DFZEXQADrx4Fvll0IjHyAjpgcJqxjB+x/Bv+MxoopC+a7Dj5udQo480Zp6D51Lu3GEBc 46Zg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AJ9MZTqp; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-212462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212462-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57cb7440eaesi174488a12.361.2024.06.12.18.49.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 18:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=AJ9MZTqp; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-212462-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212462-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 116181F220C4 for ; Thu, 13 Jun 2024 01:49:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7071E1A28B; Thu, 13 Jun 2024 01:49:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="AJ9MZTqp" Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF1A58472 for ; Thu, 13 Jun 2024 01:49:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718243361; cv=none; b=WoC/7zL7FEO8gk78XeLA7FQAJQ4XrqocWq6N1jwenBgQI+HxwiQtjWudBPnm6WphSX/up3aUy1OQ57EGMckiEtRbfKskfeRUiwqEvCktZAXQ85G1lldKU0z3HeaC09eCrgtrUpg/GOUvV+ROIlLjG6hM9sD8r4LbUiz3X8lETjM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718243361; c=relaxed/simple; bh=MKXNxvjvDMlEDAFGJ+FZDsHfj2sWvELkDCT2U73q0SI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=I8QOfCsUy5xg85+56A0tUTCfILJ5hKWwQAmr8oirJiI1Bl+J7lTrXMGfmh1vE8PexJZGV2DEc8uyKGyDFgjbYskSjzvrkfv6Uvcb2cSMXchhWXMLtv9Zk+xzoNKVJNVjNuWhpfdkbLlI4Q0S+lKt9MUfN58ZdwSCfPxnWDS+w5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=AJ9MZTqp; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-57c778b5742so344483a12.2 for ; Wed, 12 Jun 2024 18:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1718243358; x=1718848158; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=u7oeDTF4u1EiwyzNNT5qA5Y4WKuC5XsAbUMmFlcK0R8=; b=AJ9MZTqpsDIki8eGBZhJhIpVC3BYX0NdDln2KSv2lGxd3t48V5x9Wxr6U+fMpINALR QtIn0liIvzPSYKEvHPa8RaAx37Qr/KvCecrzp7cAzb3Ivh650dTX7Y4nxTRxr3R0gmv0 jpPvoDtTSQ6wS5WaoMseGleCRxEs+ahv9R83o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718243358; x=1718848158; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=u7oeDTF4u1EiwyzNNT5qA5Y4WKuC5XsAbUMmFlcK0R8=; b=EX7zEw25joGChBOAQs2ytHXvyj4bLCHL+B6lFdQgnFdxZFq+knAYC3qqJzayHSQtzC Y4BRjrvSetu+EQjdGVmpOERxq8B/YlW30vf41vW+zgpdsqPk2oSfb2rov2BP1rQ5oDyy e958k2SGubibCUOF5XovDyLAhQqQYleD5RcNcu7QKkZSSYcPDhRzg2v5QYKHU63+VL+u 31qQOMUZfj0EIQLkMTELrQyXpjEz3CWxDh2/RD1ONPocf8WJQhNuRAJqiLbwBYd46KUH 0qTQOFCASi8S2Aa4w0wFChK2V3is5tRpan7P45zNoCfGZPpAdQuijJ0f/abX8/ReavX3 3qzQ== X-Forwarded-Encrypted: i=1; AJvYcCXUhYUgGyDO+uDwgkaDiEctXqLYNV/GY4W4BR+J+pPQ6qfXNziEh7FQk1m33MigCfvlG990qZcUzosWVSZLYDf+Y8917cmk2WUCakN5 X-Gm-Message-State: AOJu0YwQVatEImS7o4FPKY83GPDOy+ydbv8wT7YART7UP7yjq2EfS/qL uSKpbkP0PW09nW6f+RZ/j2Oka9aEvv/igLDgrcbYemTd4PkbGp+UyQhTUF5UF5ahEvRWULxNfhS ZptdyuQ== X-Received: by 2002:a50:cc88:0:b0:57c:61a4:e56 with SMTP id 4fb4d7f45d1cf-57ca97697b5mr1957903a12.19.1718243357591; Wed, 12 Jun 2024 18:49:17 -0700 (PDT) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com. [209.85.218.51]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da713sm236362a12.30.2024.06.12.18.49.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jun 2024 18:49:16 -0700 (PDT) Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a6f21ff4e6dso73484866b.3 for ; Wed, 12 Jun 2024 18:49:16 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVYiepbWCKJRs/f45f7IlpmP3u1P2QvG2lwKTN2JGTUXkrw+9vhM8GjCLsBYpyNULKowGSvnzCBqPPZncyiIJHZJHuoktGjRAajcxh5 X-Received: by 2002:a17:907:eac:b0:a6f:5815:f5d9 with SMTP id a640c23a62f3a-a6f5815f6f8mr12518166b.52.1718243356240; Wed, 12 Jun 2024 18:49:16 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240613001215.648829-1-mjguzik@gmail.com> <20240613001215.648829-2-mjguzik@gmail.com> In-Reply-To: From: Linus Torvalds Date: Wed, 12 Jun 2024 18:49:00 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] lockref: speculatively spin waiting for the lock to be released To: Mateusz Guzik Cc: brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Wed, 12 Jun 2024 at 18:23, Linus Torvalds wrote: > > The natural thing to do is to just make the "wait for unlocked" be > part of the same loop. Oh, and while I like my approach a lot more than your patch, I do think that the real issue here is likely that something takes the d_lock way too much. One of the ideas behind the reflux was that locking should be an exceptional thing when something special happens. So things like final dput() and friends. What I *think* is going on - judging by your description of how you triggered this - is that sadly our libfs 'readdir()' thing is pretty nasty. It does use d_lock a lot for the cursor handling, and things like scan_positives() in particular. I understand *why* it does that, and maybe it's practically unfixable, but I do think the most likely deeper reason for that "go into slow mode" is the cursor on the directory causing issues. Put another way: while I think doing the retry loop will help benchmarks, it would be lovely if you were to look at that arguably deeper issue of the 'd_sib' list. Linus