Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp303590lqs; Thu, 13 Jun 2024 10:23:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWu7Sq4pS65UPVEppgrnl1u4Z2DqAerMxarodEQY73C2WmHrCJbZzWbUjFcYLvsNyXXTeSYi32mHOWaA57UEIynQ6MJlM9c5KoxlXrvLA== X-Google-Smtp-Source: AGHT+IEsY1KQ+Gtzrpq+UK+pSZlZ8PCaWhB9mixkCyVOn4f2M3Mt5YLN/BNt2sVCnSr5g71elmHN X-Received: by 2002:a05:622a:587:b0:441:5483:5c6e with SMTP id d75a77b69052e-44216b82e49mr2302431cf.46.1718299426113; Thu, 13 Jun 2024 10:23:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718299426; cv=pass; d=google.com; s=arc-20160816; b=dhLTgz4Ty6M4jKQIkJTwSJ2cWY3U9zop2st6Lxrk0CHg/nLapGz0Fzsl1p7/aMLluL XKEjjOhlztYapOGdMlRsGoPGwrcMeM1BGNLpces2LMyHhTxo/LcyKSjLewaKkv2Wt9B5 BvgVlRS+r2LYgfYKuEzp0QH+O+uzrEAO9bmdbZ3mgG+Mf4dGQKBnD8OlGlr0DrwXOtcd 2oMuRuiy/1Sa3mC5UicwWt8bDODXHVVuM/tkqhd25Q/ZilT0PsztjN0K1I45QB5Z8tXz pmBwu0B5xge9RSSxbDrG4+jYCJXfmBRxAGvNoyU0ugxBKvTkgxMDIyX3hPY9dVcvBroD yt5Q== 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=+2OFmWNM47yOmDpYrRVafvbtoDEP6ZH+OhJE24NiP7Q=; fh=81IBqjcs00Wg5/TGl35DHJ/Fij1Uw/H+qdft6pqlwzU=; b=EGKkHHJTyhzW3/dRDKvNQBnUkEN002FgLYCw3MkN/QCb6SvYq/5NIpK1whViKlG1kz 8S9jI6H54gw/1eK3ShxKwi0MOaIZRUt04g67R65QEV51NsRPXw/1qMtXIReApWMq90yw LHBmCM52amE33hCCEF2Z0VOOD+J8cinIliGSfBi8LZJcIHS2KFd0YKKEnSqiBUO0sJJg XYPACccOzvgFaCaNaR4TgMq2aTlPm4xw7BuOo3ns4wuTGf90V6ZRZz6Nav5R7ScPbIGI S+RrnD/WjZLKUd3yGXkBaiNvTujpMLrm4q8kjmAq5uGgFD/GfXDKokyLQKgfoeHmAB7S AkKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="X/ZuGi4h"; 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-213740-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213740-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-441f2ea9d33si18193531cf.387.2024.06.13.10.23.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 10:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213740-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="X/ZuGi4h"; 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-213740-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213740-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 03D2F1C24047 for ; Thu, 13 Jun 2024 17:23:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6BF314A0B9; Thu, 13 Jun 2024 17:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X/ZuGi4h" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 938EC12EBC7; Thu, 13 Jun 2024 17:23:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718299393; cv=none; b=R66iAfcQyUupY4KFNE7VjWlQEg2Um7d915RneneyYrpfFTSUUKYMt5PnM0NsLtL8vkb1HpwRFRa4evMMVEYzimrOY229b1bQnYfvD2p/F8HTsKGXsF0mKJXn2FSlmGRDJjAhKw9ZviZbL59c7cgfal8iXy9nUDf0F6fxQrQWBIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718299393; c=relaxed/simple; bh=+2OFmWNM47yOmDpYrRVafvbtoDEP6ZH+OhJE24NiP7Q=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WdIA06eakQAImUPTQaoPl5g7V1bkxRcKShAU/SRI5jTnlxX2NlSIQi8mOgkQd01boSaSCHTFcXDY4whmAkIWJRcrRZ7zxbSiqnCeuMkXh4Kvl0BplL64Dx2e5MCaHpG5WBB1EksNaZVOT+roG+aS8RDTA9kNVMeJR0lunJEzHcM= 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=X/ZuGi4h; arc=none smtp.client-ip=209.85.167.52 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-lf1-f52.google.com with SMTP id 2adb3069b0e04-52962423ed8so1585980e87.2; Thu, 13 Jun 2024 10:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718299390; x=1718904190; 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=+2OFmWNM47yOmDpYrRVafvbtoDEP6ZH+OhJE24NiP7Q=; b=X/ZuGi4hpLYlpYP9fC/otv0zfejU7gw2cCeiAVZozGvpPnZwH/3shGDTbHKx5s1tDi Yu4vDuhte3S8ctsdv9+XHGfBnzHo6ghrxNuj3TfYG2Wxha3fUAlvifvv4oVCymxzUH2t Wt4ZmHQ7UKWAgyLaUbMG2BTKL8FGmP1Q25NRELGU7ihxmr0lSeDLQ7Koz2aw3m6+YNAE 5m1O43E7y28iUojXbKBvyxIqyTuokxyQFd0NqSSKsv03UaOPAiMrH3R3g2mcPW9aKrqJ JHqUwbwxpJEid4voCWz9kXyezHj04YL+fvpFHF5OeCuraBNn9G40F1k0x434LJnR2f/p romQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718299390; x=1718904190; 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=+2OFmWNM47yOmDpYrRVafvbtoDEP6ZH+OhJE24NiP7Q=; b=YGEMpNNwHcBNcGZz/JVTVq4tsF5nFJLE5njHmQgIvScn8ArMf/gqG8Vn7Cx5vHXljT noT9rz3/lWQTVXlhyuUWrHoZjcF77ZlErHw8wXtJoNtSomCDRZc6mMFM4AfgOAWBZwqy riksTqe1O5BEKFyR4pUXXrXZ/TPjZvo5U2Ujx0NeHzrqFrnVqgyklomniGyHEa2f5KRL Etj1nDlaXrXUWI5YEm0hx1ck5FUxLCK9KtIo01UrdbcpauWZTuWU9cSbwTLC5Na1zCeg 0kR/wop+fUGRZI4D25+AXYXgaqngi0DRgiNkUVJi/89dzrxdfQi2R826uPuAt5dnL8xZ RVhQ== X-Forwarded-Encrypted: i=1; AJvYcCVhZw9agQ80UDAXHLrki/bBeG/ekFqdJ87F+ehWX3I+yb58/6nxJvom0MSEhGqZp7FrPF1QBswRoNKhMv2chd5/N+xIuRME6hycpZohcVUd7ZpLSyo37EoJHkUo23imZKnGOOUN5guwanImpQH6roPRsu7QHrrfv1jSuqOP11S0Ozg8VWZ3eHGaT/PasT5PGP/EtoHc9v8KpanBQuvH4dX5Qm5IoYRCMg== X-Gm-Message-State: AOJu0YzKQqJvndN/iM04TMPnIJAHtwVvZp+kysXnVmKsCYaBljywv4/f LvYdfynZxfGEWFjFMUYM10VzgXYxRRYnOXe0B+jCAnhRF06fyQHIxLT9C7qiubI6vuKDaBx1tr9 O+b/vZ6iWKpq0tgp5jsu2Xsf2l8Y= X-Received: by 2002:a19:e013:0:b0:52c:8206:b986 with SMTP id 2adb3069b0e04-52ca6e9b23cmr241057e87.56.1718299389509; Thu, 13 Jun 2024 10:23:09 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240612223025.1158537-1-boqun.feng@gmail.com> <20240612223025.1158537-3-boqun.feng@gmail.com> <20240613144432.77711a3a@eugeo> In-Reply-To: From: Miguel Ojeda Date: Thu, 13 Jun 2024 19:22:54 +0200 Message-ID: Subject: Re: [RFC 2/2] rust: sync: Add atomic support To: Boqun Feng Cc: Gary Guo , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Nathan Chancellor , Nick Desaulniers , kent.overstreet@gmail.com, Greg Kroah-Hartman , elver@google.com, Mark Rutland , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , torvalds@linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org, Trevor Gross , dakr@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 13, 2024 at 6:31=E2=80=AFPM Boqun Feng w= rote: > > So let's start with some basic and simple until we really have a need > for generic `Atomic`. Thoughts? I don't want to delay this, but using generics would be more flexible, right? e.g. it could allow us to have atomics of, say, newtypes, if that were to be useful. Is there a particular disadvantage of using the generics? The two cases you mentioned would just be written explicitly, right? One disadvantage would be that they are different from the Rust standard library ones, e.g. in case we wanted third-party code to use them, but could be provided if needed later on. Cheers, Miguel