From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) (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 43E9C28B4FA for ; Wed, 28 Jan 2026 14:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769611571; cv=none; b=iCq76iQDGeQKpgwcwBOZ5fGCRvBRzdYCITNsfJrKbGnd8sQcEeExzkWpli/URjjJ21bYWXEpHaLxUvXqvX/FejxE7BHXPOBU9ACyKg8lY00K+OKb3yLkK2qyrCWM7Fe/1jdoZbikJjWAY1LLS0JdGX8++E12uRUgpCVEJMD53gw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769611571; c=relaxed/simple; bh=x1zRG43LA/EwWbaM3PwU0X+XPRQbFtO8zNYTlFZMNxM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=M1b8s7maYH5Q8F6u4yQm69yrsVoy4jNoMI/kjGQ/CQNs8hOOJ4rBscl5SGsKZW4OzFcAqzL4wkPYiUKrpgRW8k6Z9FFvtRIct4634qLfvumnsQlJvpwVPXnIxlxFRN800OdxuHuRd2ZU9lAJCIIXjiyoJBVGAhYsUfFULyCbqVs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=1Q5nPcgW; arc=none smtp.client-ip=209.85.218.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="1Q5nPcgW" Received: by mail-ej1-f73.google.com with SMTP id a640c23a62f3a-b8709d4ff20so495463566b.0 for ; Wed, 28 Jan 2026 06:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769611568; x=1770216368; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=lzzY8deZp2K9s9zfZCJmROn2nWP4BNz5bRVLgnZ6t+0=; b=1Q5nPcgWps93O71PNg+puPFIFBbp/SCHk6m1EWR9f/VXd0AR4VCMOQzJJyLkDh16YG Mp+O8Vo79Kt9fFToP6+X5LTXqVlM76vnn90kQJijVCdtglSkFBVlg+TsokGYFz4kJ+W9 3rTKXvn7ChthtbGNl3QBfXqwWji7SHTjVwU3DY/gn540ngK0YaSIgCCTd+r6656skcHS MIin1t83RE/EUYOwt/7oYGyzCREerPZLs7ScMwdVRRt0Y1QDl1PjgE7tRqBKJLgYAkKU b5QSXU1v2dGcQ3RkL5tDiRb6M+/9FHjgSgOexBRe8sP4Tmzfj8ZuuQ6cG1LQGBabimtD truw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769611568; x=1770216368; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lzzY8deZp2K9s9zfZCJmROn2nWP4BNz5bRVLgnZ6t+0=; b=mxCBnKGpa7OaaD1JbNdn/tPGq67p29G9rLiKG5hqXaLKAh43JEzptgnfVdR1UYDJkO ACsOBqwA93erouLg+kFPFjb0AhPhdvAcxoEk6SsnudVmJqmMWLntmLgaC2hxmFPBHsBf ZY0EHTHHoBAUoi6aG3HAY/PcI5J90p9m/X7RaiGJScJgv/W8dnGLWSBakHmFUWqmgwiU c4cEbGJoK6KWRrHrRPwOY7cWNBP48UyNkllL4WNHClNxz2M98YSMmb0QmMv/VDhg8euc YIx2UfZNwgN4rDvjC4d9qf41BS7zyRfxFav1Qfwte3YLp4u0drEvw25rEJHvYDJ2WMd/ aiRg== X-Forwarded-Encrypted: i=1; AJvYcCUuoqLSWxmBAToW7JdtkcZvEXA9wAmJGVJKnFErGS2M5xcTVvpZhUYujTvmQxFiPLxeVW93aw61HSpqiDQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9j1QxN91RN+qwZkb6MpxKNfZRbrDqbNkbOmc8RiTAh+hDRX6Q q8MYuASFz7cwfKRtyV3rXBJKBbJWfF0DLwQpsNcwbxuKnv214x/BZBMXAwgX6iLaS2ENAduOnue A043CXmz1uQojaftaww== X-Received: from ejye2.prod.google.com ([2002:a17:906:8442:b0:b8d:c324:47d5]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:3f1d:b0:b88:4673:68ea with SMTP id a640c23a62f3a-b8dab45b85amr373703566b.45.1769611568636; Wed, 28 Jan 2026 06:46:08 -0800 (PST) Date: Wed, 28 Jan 2026 14:46:07 +0000 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260128-cache-aligned-v1-1-a4eb7c3ffd35@kernel.org> Message-ID: Subject: Re: [PATCH] rust: add `CacheAligned` for easy cache line alignment of values From: Alice Ryhl To: Gary Guo Cc: Alexandre Courbot , Andreas Hindborg , Miguel Ojeda , Boqun Feng , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Trevor Gross , Danilo Krummrich , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Wed, Jan 28, 2026 at 02:41:05PM +0000, Gary Guo wrote: > On Wed Jan 28, 2026 at 2:25 PM GMT, Alexandre Courbot wrote: > > On Wed Jan 28, 2026 at 11:05 PM JST, Andreas Hindborg wrote: > > While 64 bytes is the most common cache line size, AFAIK this is not > > a universal value? Can we expose and use `L1_CACHE_BYTES` here? > > On all archs that we do support today, I think the value is always 64. However > it'd worth putting a FIXME or TODO (or assertion, maybe?) in case new archs gets > addded where this isn't true. Are you sure? From Tokio: > Starting from Intel's Sandy Bridge, spatial prefetcher is now pulling pairs of 64-byte cache > lines at a time, so we have to align to 128 bytes rather than 64. > > Sources: > - https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-optimization-manual.pdf > - https://github.com/facebook/folly/blob/1b5288e6eea6df074758f877c849b6e73bbb9fbb/folly/lang/Align.h#L107 > > ARM's big.LITTLE architecture has asymmetric cores and "big" cores have 128-byte cache line size. > > Sources: > - https://www.mono-project.com/news/2016/09/12/arm64-icache/ > > powerpc64 has 128-byte cache line size. > > Sources: > - https://github.com/golang/go/blob/3dd58676054223962cd915bb0934d1f9f489d4d2/src/internal/cpu/cpu_ppc64x.go#L9 https://github.com/tokio-rs/tokio/blob/master/tokio/src/util/cacheline.rs#L85