Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp331577lqs; Thu, 13 Jun 2024 11:13:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUvoxy6gCnF8Oldht8VMfb82MK5oQg6Fy6Dd2WvOGVTGXw4dbv2jtzo3guxjpsFeVrAX9ncaz7Hfi28nkDg/WnA2QsejL9hOEOaWMWCOw== X-Google-Smtp-Source: AGHT+IFP/McrrgQpkAGTIjI9jMsp+In5ec4bYbjOLEqJiQbFnIAbLBXVr1N3e2Cazyp30nDi758h X-Received: by 2002:a17:907:10d2:b0:a6f:147f:7d06 with SMTP id a640c23a62f3a-a6f60de642emr30248066b.77.1718302416384; Thu, 13 Jun 2024 11:13:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718302416; cv=pass; d=google.com; s=arc-20160816; b=s6Bzug3/Ex6RW1JmFaavebrDXKKz1Swn8yk/K6PdDj/NNpdK/TQ1VBJU38FfXnskh+ SXsYfxcgCoo9cHh4y4I6p2Vb/CsxRxa3zIse9v2BFEUm6nbn0m2W9KlX0Y4yU5SbSViL ZJ/2OMQwpOJSyepwPhFjAOQ6do3oxcV9ShjgGUDQ0hjhQcQ9KEyT7cXbYFhZ7jJBk2jh Vfv1V0zJh01rfIGqG/atX9l8mvld4g3NwEzyq08DQZegkyU4pK2R4eWXlRHdZ6OlEomM 1OKMsVYa/HiaP57lyC2o3qPrZ8oR72w0S/5i274D6gAO3tvBlqQn4eynJ7LmbQXotdmJ AD8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=wNNl8rrQPycSg4IXL1NS7035Hu/VIN3/XOUEICPOlvQ=; fh=uTvtY5yjgB/NE9uUqvcyGbSgGF+tuZG6R6FN3pCFlAQ=; b=OyukfcNKPeWAGGRVJ/koon1IqgJc5emKURsux6WDu5alqSVSD1x6uFlVrbTzWFxkBw KmYzBniilL+wYFqecnfPQG36NzqFgmL9FnN8KFITywTQ7w8tCPhoE1XR9th7ZrvHibPs y7hqK8AiGFRkm8UgKIr0DC7S2Ia+gcMZmllGAkX5qBEuBaNc7KC/mnaofiDopF8yocBg +bXLY86wBIc2iL3THTFf7Pk79QhdrlTYDzO/wwySKYTvM/7NXnaeKyyAjN8MVapj/tBo dTqyfxzQma+OF9QW14D6xh1+kiOFInvkuvVrAxm35SHZJ67DPOpGyPFCNGoFWN1HRrKE +Heg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ljbStTQj; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213795-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213795-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56dd6f74si88039866b.420.2024.06.13.11.13.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 11:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213795-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ljbStTQj; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-213795-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213795-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 1CFA11F22ED8 for ; Thu, 13 Jun 2024 18:13:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 046931448ED; Thu, 13 Jun 2024 18:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ljbStTQj" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 A937D14A4F0; Thu, 13 Jun 2024 18:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718302407; cv=none; b=Q85mCHdjtQ7rwJbgzyGWytXfOhtHNKtgipAqGxo74fecGpFZEtYlDPLG20O3uVQCjqe4TSrEGgi1mMMJgT9YylJctDa1HsGSMP/gVjOOrrMJ3QX7CXT7JF9zAvtQ/0k33KQ13IJaSt+RTtY1i1e3UVd4JIqOpHCc99p7InBzP6c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718302407; c=relaxed/simple; bh=wNNl8rrQPycSg4IXL1NS7035Hu/VIN3/XOUEICPOlvQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=SiZ4SmorIk1YInZ/1Iq3gRmgZ/zixa+mUtytDyAq99l/7Wdnj0/cGcW6dHOJgbvG1qkXUS7bQNDKZGsyq8QVAPtzCLQCRHotfWaTZX7FwqNu0v/m1wNTLse0m0FTVuq5Vw2TBr+p+xXvuncduxBwSYZbOEss1dmxO4LLgAazb20= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ljbStTQj; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-57c8353d8d0so1601144a12.1; Thu, 13 Jun 2024 11:13:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718302404; x=1718907204; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wNNl8rrQPycSg4IXL1NS7035Hu/VIN3/XOUEICPOlvQ=; b=ljbStTQj5l2UkGLsjkeEdPMsvJxQgTAJFSNDTfBP+AxdVwMY3IFzJvayeC0jGE/Zex BZuJXrcTcVZgTQVqF0HaPpdy3B2jK66EcubnuCFInykukUhA4LaQkglzxmWMcWlt7M+Z 0iwqpArn1wZRkNy/HISQomyBiGRv3FIUfGOeZ2ZLZk/79vgm5yskcKVACst2cmlUxust IiIVtWS7Vdv9zRFRXtllSfV+FARtUPL0/n8sdLxIOrrlbHdl6+VRb/3Wr3RtstBEj7Ln QRXlcY6HCDiyyZ6Ao1Fce0DlT/rM/oBx796ByD3G/Vw7U8sKLrc76wAkbElPhHVbxwQ1 Q1Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718302404; x=1718907204; h=content-transfer-encoding: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=wNNl8rrQPycSg4IXL1NS7035Hu/VIN3/XOUEICPOlvQ=; b=VqvQW7IEJ4+kWlA8kLWke03sNLAdnH+UftVCp81wKz5uZ7fmTSPLS9N4FDidXyrgDh Pc3tOjKCMojPNvmAhrSQiugGK9IYwxLxzkrAg/LfKpcBJSWsKVFnxJdsetYfhPKJ5fNx 5XInH9GnUZYS9tgqnKx0TngCbvyo6w/jSW7s+rPckXcFTtjDXSlQDQbjWqmlM4+ZPBCm IAuNwY3cirzCgLLvX5eQCsU1jzenY+l3SF0QtU7OoknWVk3U6zLszIcKEgRTNOq4OAsN 7om3N1ik7ll6Uaz+vx4rLHf2x11kWlWD6Ne0b7mrpGLFJWlHMkPz6AAKtYXlVefd+9Vo gLIg== X-Forwarded-Encrypted: i=1; AJvYcCW4htjjEbEYSyDF1NGc9fo/7d7QeuxFQ/lY2LtSUuUSS0WgBHgGfCwiOMfryRY7nmJ3bE/oWkv04RG0CQEzpNQD5Bdss2sg0ecnRBsVkmH3DlFAbKwMfEC14PPCCQws6OC1c6WqhFsWPfWsYA== X-Gm-Message-State: AOJu0YzPjF8NDrUazOMKqIyNIvhf7ce2Cwg8IE17exyrlwJPpLGOELt+ Omrl6LFWTFiAPvEyaGlPaeQeqVz7vVvw1B90iqByak8yX1ZL0hkduilTtdAFDqVxy7Z7EU9oBqt n9FGBF6sdEIi976ERrouH5Fpa87s= X-Received: by 2002:a50:cdde:0:b0:57c:74a3:8fd2 with SMTP id 4fb4d7f45d1cf-57cbd67f655mr488376a12.21.1718302403764; Thu, 13 Jun 2024 11:13:23 -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> <5cixyyivolodhsru23y5gf5f6w6ov2zs5rbkxleljeu6qvc4gu@ivawdfkvus3p> <20240613-pumpen-durst-fdc20c301a08@brauner> In-Reply-To: From: Mateusz Guzik Date: Thu, 13 Jun 2024 20:13:10 +0200 Message-ID: Subject: Re: [PATCH 1/2] lockref: speculatively spin waiting for the lock to be released To: Linus Torvalds Cc: Christian Brauner , 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" Content-Transfer-Encoding: quoted-printable On Thu, Jun 13, 2024 at 7:00=E2=80=AFPM Linus Torvalds wrote: > > On Thu, 13 Jun 2024 at 06:46, Christian Brauner wrot= e: > > > > I've picked Linus patch and your for testing into the vfs.inode.rcu bra= nch. > > Btw, if you added [patch 2/2] too, I think the exact byte counts in > the comments are a bit misleading. > > The actual cacheline details will very much depend on 32-bit vs 64-bit > builds, but also on things like the slab allocator debug settings. > I indeed assumed "x86_64 production", with lines just copied from pahole. However, to the best of my understanding the counts are what one should expect on a 64-bit kernel. That said: > I think the important part is to keep the d_lockref - that is often > dirty and exclusive in the cache - away from the mostly RO parts of > the dentry that can be shared across CPU's in the cache. > > So rather than talk about exact byte offsets, maybe just state that > overall rule? > I would assume the rule is pretty much well known and instead an indicator where is what (as added in my comments) would be welcome. But if going that route, then perhaps: "Make sure d_lockref does not share a cacheline with fields used by RCU lookup, otherwise it can result in a signification throughput reduction. You can use pahole(1) to check the layout." [maybe a link to perfbook or something goes here?] Arguably a bunch of BUILD_BUG_ONs could be added to detect the overlap (only active without whatever runtime debug messing with the layout). --=20 Mateusz Guzik