From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4A7AC27C53 for ; Sun, 16 Jun 2024 15:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Den/1z1anEDN62vUgoFYzRYPggQf712PLr0MqmeLw5s=; b=yXPta+8mqouHlEF5cdclKw630l 1D98YeGckzwSkscQjjN1nvJcF1Rb6o/wz/8qhdl/woNQfpWZNpEwh8UTbDZ56cLwjdUHZNy3lVIgi Sw6k5Thx11wLThjNSTYHFO08Fi8kwNENI4G+tDvj0j6Y4WyLWwsGFO5W9uojv+D7p7Pj0+yoEObzm wngtybbSDpvUTekAVJdygf4/GsXJ0p8MajFEuXPPgqJF/V0lZkwMchKrd//71bnwt43W8NPE17pAH UFAb7Yg7lVVGzLW6GhN/1eR0DoANbJnR70Jl5ScohEKHS4NIz1xIXU4UuX6haeUUdtf3q+jLON13O zWbFL7GQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sIsCv-00000007pcN-3bU3; Sun, 16 Jun 2024 15:54:17 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sIsCr-00000007pbT-1q56 for linux-arm-kernel@lists.infradead.org; Sun, 16 Jun 2024 15:54:14 +0000 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3d23db75f5cso2209134b6e.0 for ; Sun, 16 Jun 2024 08:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718553252; x=1719158052; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=Den/1z1anEDN62vUgoFYzRYPggQf712PLr0MqmeLw5s=; b=cy3eHjI7aS3E/r9T/2e45qGRoP/kU1o1aads+QVZoIc+4jn4YnYjm2cGjreDqTD4X/ ZS3C75CY2lxgp2o7rooE+ajEepaGhwrlan46lq3xLSiNvAt+tDldOjNzcrWyXxPWguB1 6gfj2CwLg03TSryJ9JCvSa4aCp1kzozF3yBl0tqQZKcoCSf60jOubV3dwRhl24u52aol KPP5wKlbRTmLoQ0GzpHj8TUkPURqfD0dR3iN+qTVQAsVpTpIOON86kgkDt8N/+pcikjv JnckOblO1NeUYwF/e3FA1JVevuDPYgRKPoBf3FdogL0MQ7QkROyGwQfCIqDLF5ZX1sNp lvUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718553252; x=1719158052; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Den/1z1anEDN62vUgoFYzRYPggQf712PLr0MqmeLw5s=; b=BOLyN97mv9Kua5qpTGIDFhWoaHH9Y0CGNHxq+z0dy4+suvdtvt6OfRhhGzRPIHkGIE s1EJnBF4tc1ogEiELlZCrDug5YbTppJpVJrcxavWQtuhHuqxqH8g8GzvCLDn8aXJgQZ8 0qUPJRRRkGDA98mtubn4HE3q42FTnTDnY5C3vetTLmBmAZOwe3+k2nZiuV3hTPSD41RR vhmyy2FhD+5I9HpSRdHfAvnUIec/wAIfUWcVfhl670pI+pvU4nIUdjRyDdRkiCC4DX++ tL5AIJ0Kn10j/fDfLTRhklOSbOrRELMR/j+BMpg29oEkFZ7ZMl77sxbXlTgMeUoCLlXb IETw== X-Forwarded-Encrypted: i=1; AJvYcCUHlVbsuWJuUkoQoehxq9nH3EVXC7NRO2yB9dVL1jEdiwEVSpbSgTFr75OLTDwmkyQ/uA9J1di9kuNrAmFR2jekq8xF5mODnkmxSrXqiRlGybvl7CY= X-Gm-Message-State: AOJu0YwbaV2d0vUS7jxjTr/S/ewjbxn2cAVJW+XKcUxxHkiwGkBoRFGl QXaFAp8LgmoN1+bxOwHyD9GYXT2NMeW/v8zkNSNnPmBm9z+dpRil X-Google-Smtp-Source: AGHT+IHDvxUTXfVltv71Hz0qCRr5nwagnmoPpnsgdrxerLfOV1wrFqvVvIBF3cjJ1pV5xZY4wKrXgQ== X-Received: by 2002:a05:6808:21a9:b0:3d2:15a6:4015 with SMTP id 5614622812f47-3d24e8ef7fdmr9070711b6e.24.1718553252287; Sun, 16 Jun 2024 08:54:12 -0700 (PDT) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id af79cd13be357-798abc0719fsm348763885a.83.2024.06.16.08.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 08:54:11 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfauth.nyi.internal (Postfix) with ESMTP id BFA591200043; Sun, 16 Jun 2024 11:54:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 16 Jun 2024 11:54:10 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvfedgleegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpeeuohhq uhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrf grthhtvghrnhepvefghfeuveekudetgfevudeuudejfeeltdfhgfehgeekkeeigfdukefh gfegleefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedt ieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfh higihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 16 Jun 2024 11:54:09 -0400 (EDT) Date: Sun, 16 Jun 2024 08:54:09 -0700 From: Boqun Feng To: Kent Overstreet Cc: Miguel Ojeda , Benno Lossin , 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 , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , 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 Subject: Re: [RFC 2/2] rust: sync: Add atomic support Message-ID: References: <5lwylk6fhlvqfgxmt7xdoxdrhtvmplo5kazpdbt3kxpnlltxit@v5xbpiv3dnqq> <4pez6kilgykarr5qeutgaw3pvkxf2nmh4lzuftadshmkke7d3q@3jfgvjveqdbz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4pez6kilgykarr5qeutgaw3pvkxf2nmh4lzuftadshmkke7d3q@3jfgvjveqdbz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240616_085413_519839_0154B081 X-CRM114-Status: GOOD ( 38.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Jun 16, 2024 at 11:32:31AM -0400, Kent Overstreet wrote: > On Sun, Jun 16, 2024 at 05:14:56PM +0200, Miguel Ojeda wrote: > > On Sun, Jun 16, 2024 at 4:16 PM Boqun Feng wrote: > > > > > > Hmm? Have you seen the email I replied to John, a broader Rust community > > > seems doesn't appreciate the idea of generic atomics. > > > > I don't think we can easily draw that conclusion from those download > > numbers / dependent crates. > > > > portable-atomic may be more popular simply because it provides > > features for platforms the standard library does not. The interface > > being generic or not may have nothing to do with it. Or perhaps > > because it has a 1.x version, while the other doesn't, etc. > > > > In fact, the atomic crate is essentially about providing `Atomic`, > > so one could argue that all those downloads are precisely from people > > that want a generic atomic. > > > > Moreover, I noticed portable-atomic's issue #1 in GitHub is, > > precisely, adding `Atomic` support. The maintainer has a PR for > > that updated over time, most recently a few hours ago. > > > > There is also `AtomicCell` from crossbeam, which is the first > > feature listed in its docs. > > > > Anyway... > > > > The way I see it, both approaches seem similar (i.e. for what we are > > going to use them for today, at least) and neither apparently has a > > major downside today for those use cases (apart from needed refactors > > later to go to another approach). > > > > (By the "generic approach", by the way, I mean just providing > > `Atomic<{i32,i64}>`, not a complex design) > > > > So it is up to you on what you send for the non-RFC patches, of > > course, and if nobody has the time / wants to do the work for the > > "simple" generic approach, then we can just go ahead with this for the > > moment. But I think it would be nice to at least consider the "simple" > > generic approach to see how much worse it would be. > > > > Other bits to consider, that perhaps give you arguments for one or the > > other: consequences on the compilation time, on inlining, on the error > > messages for new users, on the generated documentation, on how easy to > > grep they are, etc. > > Yeah, rereading the thread - I'm with Miguel and Gary. > > Generics are simply the correct way to do it, if the wider rust > community didn't do it that way I think that can be chalked up more to > historical baggage or needlessly copying the base integer type scheme. > > Let's please do it right here, and generics are the correct approach. If so, maybe we should do u instead of u8, u16, oh, and probably just Integer instead of i{8,16,32,64) and u{8,16,32,64} ;-) Regards, Boqun