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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EC73D17129 for ; Mon, 21 Oct 2024 19:46:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF56E6B0089; Mon, 21 Oct 2024 15:46:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA4DA6B0092; Mon, 21 Oct 2024 15:46:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9CD86B0089; Mon, 21 Oct 2024 15:46:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BAE246B0089 for ; Mon, 21 Oct 2024 15:46:19 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F320F141BF3 for ; Mon, 21 Oct 2024 19:46:02 +0000 (UTC) X-FDA: 82698640248.27.415FA25 Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) by imf29.hostedemail.com (Postfix) with ESMTP id C9D5B120006 for ; Mon, 21 Oct 2024 19:45:56 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=ryhl.io header.s=fm3 header.b="bTlg/rmA"; dkim=pass header.d=messagingengine.com header.s=fm3 header.b="L 9+AX6v"; spf=pass (imf29.hostedemail.com: domain of alice@ryhl.io designates 103.168.172.150 as permitted sender) smtp.mailfrom=alice@ryhl.io; dmarc=pass (policy=none) header.from=ryhl.io ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729539926; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nVSNeQ8pRXqtaa1i/ayXGAtU7aaY0oQNDtra/+rIYGU=; b=MWqMK7nScFFOcsGH6e2GPareu1ZqfSKdTEL+S3lpsjfvuoGdE8H+/VRMcPAUfbSSeFcTq1 l/7fbGwb+4Fy3Ci1/lqHl+ru4bMYdhiSoQJejph9HCry2+/0v17dsAtHSqGe75HeluNOyy Mvhc2uy/V7EPqe8gSBsMkzUDc9kLQoA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=ryhl.io header.s=fm3 header.b="bTlg/rmA"; dkim=pass header.d=messagingengine.com header.s=fm3 header.b="L 9+AX6v"; spf=pass (imf29.hostedemail.com: domain of alice@ryhl.io designates 103.168.172.150 as permitted sender) smtp.mailfrom=alice@ryhl.io; dmarc=pass (policy=none) header.from=ryhl.io ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729539926; a=rsa-sha256; cv=none; b=oZKWONOnoT6O6wKs3y01VM6WzT2l+uWIgxjIoop4Bl5mGbvinJB0trbbS+TU9zXWEolsvH R6C488YH8Mdv1ezaWJtNE1zdKtVtADcQIuQLMoI/Vi5hn99zumZUcJDx571IOIIourLJk8 u5GbOUXUytj8N5Fj7jrE4nHorXOnL10= Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 6AFA913800EC; Mon, 21 Oct 2024 15:46:16 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Mon, 21 Oct 2024 15:46:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ryhl.io; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1729539976; x=1729626376; bh=nVSNeQ8pRXqtaa1i/ayXGAtU7aaY0oQNDtra/+rIYGU=; b= bTlg/rmA94EhLc+ywVQ2CyE3axjRYJPiVitN7erZt/R3HE8E8m/yl5aZXXuMioVa 09ZigGRkVphyt9F52r1lc/rhknlRqyII8D3H2ZSSJPlugqe6uns8qeS5Se6F5hlR fYbyW/QHRHTF8lX91k/ateDnC60wDbNwaGhd1I9VeWEgbz1246cQxjunVtzUAgXd lNSqB5eNySW8xICwSaT3HG/SJMrfCsFPehAS0RPL3FVcopYJYLcbIV+psI3xaCAD 9leTsc8Jp9URjy7u3TH6X6c3FmjWDxFLEYWlC0P9uKQGqAKkome073X/U3Fy2Qa7 DxlfhYHGs0h2RMzl/Cws9Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1729539976; x= 1729626376; bh=nVSNeQ8pRXqtaa1i/ayXGAtU7aaY0oQNDtra/+rIYGU=; b=L 9+AX6viACEmVROHmvaH+KzT7FP/l49Q7L0FxjF3OiDKR9KaImTDF/XX4fajac5c0 SpdfSipcIZLmXgFf4wBeixZ8xoFqcO008EE/1nHnaE3FNchu2/uGODD8ov/zhSvz 8Bjw1oyraYi5VP9h/nuiXtDjg9zguqX/9mYnFsz7IgSpzvuw4hdSC3wdUOEv4g/P YGRuIrwTIvX8/JB+v+eCarpoltiqrSNSpQ3KDYK2OZUPTuryBk7dk9oTBNumu63t xrkIwqExSN1O8pFIqhKjbBeA6Yj67xqcVaXyx/faOB9lIitgUmtOIQgsOnaRzVNz cgbCWidX+Du6PTaP+vVzg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehledgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddv jeenucfhrhhomheptehlihgtvgcutfihhhhluceorghlihgtvgesrhihhhhlrdhioheqne cuggftrfgrthhtvghrnhepkefgieeigeehgfdvffeltdevuefgtdfhfeehgfegtddtjeej tefhvdfhtdehkeetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheprghlihgtvgesrhihhhhlrdhiohdpnhgspghrtghpthhtohepudeipdhmohgu vgepshhmthhpohhuthdprhgtphhtthhopehjhhhusggsrghrugesnhhvihguihgrrdgtoh hmpdhrtghpthhtoheprghlihgtvghrhihhlhesghhoohhglhgvrdgtohhmpdhrtghpthht ohepmhhighhuvghlrdhojhgvuggrrdhsrghnughonhhishesghhmrghilhdrtghomhdprh gtphhtthhopehojhgvuggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopegrkhhpmhes lhhinhhugidqfhhouhhnuggrthhiohhnrdhorhhgpdhrtghpthhtohepfihilhhlhiesih hnfhhrrgguvggrugdrohhrghdprhgtphhtthhopegrlhgvgidrghgrhihnohhrsehgmhgr ihhlrdgtohhmpdhrtghpthhtohepsghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmpd hrtghpthhtohepghgrrhihsehgrghrhihguhhordhnvght X-ME-Proxy: Feedback-ID: i56684263:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 21 Oct 2024 15:46:13 -0400 (EDT) Message-ID: Date: Mon, 21 Oct 2024 21:49:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] rust: page: add Rust version of PAGE_ALIGN To: John Hubbard , Alice Ryhl Cc: Miguel Ojeda , Miguel Ojeda , Andrew Morton , "Matthew Wilcox (Oracle)" , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Trevor Gross , linux-mm@kvack.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org References: <20241016-page-align-v2-1-e0afe85fc4b4@google.com> <81e9b289-b95c-4671-b442-1a0ac3dae466@nvidia.com> <682c97a0-9877-4e31-b180-c1e38d3bc883@nvidia.com> <7d708e79-1a94-499e-a0e8-c3431aeaea3d@nvidia.com> Content-Language: en-US, da From: Alice Ryhl In-Reply-To: <7d708e79-1a94-499e-a0e8-c3431aeaea3d@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Stat-Signature: ics789krrr8kirisyin7p4xxg6or8xxj X-Rspamd-Queue-Id: C9D5B120006 X-Rspamd-Server: rspam11 X-HE-Tag: 1729539956-404101 X-HE-Meta: U2FsdGVkX1/ZDyOKSFIdr6tcske9Yw/iftuM7Pag7HUnebynMrscT0JCIhT9VFIubQMxpJpbmaL3+AeeVyJfITzDYCjs1o1ZWLgNZTRLdDyir+0IBoo/AJEOfpeWN8JuCls0iMT/5f+dOhdw9CLfSbPAnAxRZx1PG8LdSc5ReAA2ErunybFwjylDZc8GUqfeJnoPCbDVZWJFeGlDnMeIxxnDVI8UPvgOPE/x4live5UiTl/8rUMJO+TQANpmCdAnnxAZth8gkgzAikabua59+FOLu/IoSKHz0j+ZGkNU7dip2eHERiiPj/F0b1AmTnhLEmC+3ipdmzBgDoWotVrpG/jMD+4WSkABP/VSz63W1M9MW6U/xUwx4gomQbRbGRb286AEuE2SmHk00QZlAAboLtkaxwCQLObdZtSUomu0cQtrRtAUab9/Zr2JJX6rrECANsVd6FeTGAovumJsUZGL/ZiQCtoN/euH82/5PSbuXUxxYAlekCHco/q1t8yioIR/+v6VULZXNHllbWeP22b/c6VaXDXZj0F2gUVQJ/+A8+Vb7pqYV6PTDad73jG/ZpRLfzoLdl0J5TPkqxq8KLQnKrKJq5xHdLG6NMLY0hdJr0yqVf9+BXW3Me49exo9af3Rzkf3k02X7Nc4gNOAqktoumao61ZcyKCM4WSnssSitFYbF5XsabtQtxZA7EeQGV+VkDOj8L6Y8kCwaxKGUfPW2USr94JuEka6jhguI3PiDXt/PjsY79MAuY0OMbPO0uWKbyMIcLx6BdYnLPSqF5ngETXHYyvI0a/Fqw2PVcLb+BmFz0VWmRZmr0quLc98kLtYQK7CKXKCl6VFdDqvzIRkTanazsEpZNCifdlfZ1CngsQxGtlnguOBs/gMW2GwXDeFQ+MpqzzWQzNhNODuitpM1d2kHHeVDv7Yyq2RiOgic2rtGhcwF4jZPzF/u1yQTah94J/4sE96QXrRtRt/CnX A1qp35CM C2Plm1dDP7kSAmatsREdgds2PSLLPzVPVyn/MrEH/JBkcQBIJUFiIkBp545Ih9EziuQttUGFvb8d5SguYivRoF5MWFw/sQU6HNuHWoPfw88sCRzOwpeGkpMjgK1zufTd2KeiDaMtSLSrAJavaBfKYHeA5zktz1/t4c/llHdfW7T4HaX5u7WCwEtcpkSeAkj4XgV+9HaK8oFpUtYEq3pstZK9Z3LUMCiVMMXkd9apcitEz3ppdY5cHFUuwyzW6aGsBwPZPjtvxCK1dh0uzzuLQ+DXQ0udzb0eLYhVtj+W3l0kjwZ1PvpkffiRIJJobFYL7MJpwXe6/rPHh3Z8tTJVp1GAOE36bxaTFMvgnZY7eWsXv64yu434CJtTXbeysZUJ64e5/HKGHxavfVl0N1SseKhk1T3V9MN2fmAHdcFmREPrQYq2cYFECzXjiiIbofRiM1GGfxz32d+87BLx0dskv2T1M30VRm/RHiQ9/DZMg/A1R0XENFqX7seuahwTh2KQmjbuqINqZ5PDv8Q7tNwFyqHeEkg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000106, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 10/21/24 9:34 PM, John Hubbard wrote: > On 10/21/24 12:26 PM, Alice Ryhl wrote: >> On Mon, Oct 21, 2024 at 9:09 PM John Hubbard wrote: >>> >>> On 10/21/24 11:59 AM, Alice Ryhl wrote: >>>> On 10/21/24 8:41 PM, John Hubbard wrote: >>>>> On 10/21/24 11:37 AM, Miguel Ojeda wrote: >>>>>> On Mon, Oct 21, 2024 at 8:35 PM John Hubbard >>>>>> wrote: >>>>>>> >>>>>>> Is this another case of C and Rust using different words for >>>>>>> things?? >>>>>>> Wow. OK... >>>>>> >>>>>> I am not sure what you mean -- by BE I meant British English. >>>>>> >>>>>> See my other reply as well -- I just changed it anyway because Rust >>>>>> apparently uses "parentheses". >>>>>> >>>>> >>>>> Right. For spoken languages, that's simply preference, and I would not >>>>> try to impose anything on anyone there. >>>>> >>>>> But in this case, at least for C (and, from reading my Rust book(s), I >>>>> thought for Rust also), "parentheses" is a technical specification, >>>>> and >>>>> we should prefer to be accurate: >>>>> >>>>>       parentheses: () >>>>>       brackets:    [] >>>>> >>>>> Yes? >>>> What word would you use to collectively talk about (), [], {}? In my >>>> native language they're all a kind of parenthesis. >>>> >>> >>> Good question. I've never attempted that when discussing programming >>> language details, because it hasn't come up, because it would be a >>> programming error in C to use one in place of the other. And it is >>> rare to refer to both cases in C. >>> >>> Rust so far seems to have the same distinction, although I am standing >>> by to be corrected as necessary, there! :) >>> >>> At a higher level of abstraction, though, perhaps "grouping" is a good >>> word. >> >> Rust macros can use different types of brackets. For example, the >> `assert!(1 < 2)` macro uses round parenthesises, the `vec![1,2,3]` >> macro uses square parenthesises, and the `thread_local! { ... }` macro >> uses curly parenthesies. The round and square brackets are used for >> expression-like things, and the curlies are used for things that >> expand to top-level items such as global variables or functions. >> >> Macros cannot use any other delimiter than those three. So e.g. <> >> wouldn't work. > > That answers my implicit "are there any cases in which you would > want to collectively refer to all three types of...bracket?", yes. > > For the original point, though, we are not in a Rust macro. Is it > actually allowable to use [] or {} here: > > +    // Brackets around PAGE_SIZE-1 to avoid triggering overflow > sanitizers in the wrong cases. > +    (addr + (PAGE_SIZE - 1)) & PAGE_MASK > > ? Is that why you were not seeing a difference between saying "brackets" > vs. "parentheses" there? If so, this would be yet another case of my > Rust newbie-ness being inflicted on you. :) You can use both () and {}, but you can only use brackets if you're European. ;) Using {} to create a block works because a block evaluates to the value of the last expression in the block. It would be super weird to define a block here, though. Alice