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 CF559C433EF for ; Fri, 17 Jun 2022 07:59:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CB7E6B0075; Fri, 17 Jun 2022 03:59:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 57B976B0078; Fri, 17 Jun 2022 03:59:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 443066B007B; Fri, 17 Jun 2022 03:59:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 356CA6B0075 for ; Fri, 17 Jun 2022 03:59:03 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 117F561561 for ; Fri, 17 Jun 2022 07:59:03 +0000 (UTC) X-FDA: 79586976966.03.11EE04F Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by imf02.hostedemail.com (Postfix) with ESMTP id AE164800A6 for ; Fri, 17 Jun 2022 07:59:02 +0000 (UTC) Received: by mail-qv1-f44.google.com with SMTP id u8so5436132qvj.2 for ; Fri, 17 Jun 2022 00:59:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0TaGn1ZE7rwA4T26FHJ9s8LxCIwOl88lHCKLCSlYvUQ=; b=TXY+N56gVHLJ4wvt4+etdKA8J646mg8Dd1wxprZjqiUmXbjqJAF5wleZfGIlUUj9y5 71S9RY1f0n7ceaGCzOB50SdvK4zu7ArZKggMX3srDDnthuLf295Y+tLYgfl5dpQdbTAO i1H1z7EoYQvBcf901wNs3Zbe2vG0JY+W29hnyjvj0nLw+AyydjxzZT9emtHfOxtc/83/ 1v/L6HvlMH1czjSlGI+HZ1rVVkEOoybAGSRcLQfEB+t+TqoHvZsmpkMhIBIsmfI/oPaa HU9kIvw55oc+eetA197tC7szakbjprdqAoBOUVaE2fG9JlRPkpDpCZkya673oa23o6SI 7uWg== X-Gm-Message-State: AJIora+K/I2663nnULPnPpRuRkbd5W1keyK+IcuZequ/0pExQax1LwWr GnY9vsz6/3FHsup/8KfXG4mot7suObgIAA== X-Google-Smtp-Source: AGRyM1sUNMIe0IJkAVU4UHeuPBMIxColE7n6xJ2szfCRekx/ndzAxaX+o7SwsmWve3YjSnJhW3Ze0Q== X-Received: by 2002:a05:6214:e4e:b0:46a:fc75:2719 with SMTP id o14-20020a0562140e4e00b0046afc752719mr7169982qvc.130.1655452741813; Fri, 17 Jun 2022 00:59:01 -0700 (PDT) Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com. [209.85.219.170]) by smtp.gmail.com with ESMTPSA id j1-20020a05620a410100b006a684c87f4bsm4103957qko.68.2022.06.17.00.58.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jun 2022 00:58:59 -0700 (PDT) Received: by mail-yb1-f170.google.com with SMTP id t1so6027230ybd.2 for ; Fri, 17 Jun 2022 00:58:58 -0700 (PDT) X-Received: by 2002:a25:818c:0:b0:664:a584:fafd with SMTP id p12-20020a25818c000000b00664a584fafdmr9236239ybk.543.1655452738571; Fri, 17 Jun 2022 00:58:58 -0700 (PDT) MIME-Version: 1.0 References: <20220616143617.449094-1-Jason@zx2c4.com> In-Reply-To: From: Geert Uytterhoeven Date: Fri, 17 Jun 2022 09:58:47 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] usercopy: use unsigned long instead of uintptr_t To: Linus Torvalds Cc: Matthew Wilcox , "Jason A. Donenfeld" , Linux-MM , linux-xfs , linux-hardening@vger.kernel.org, Linux Kernel Mailing List , Uladzislau Rezki , Kees Cook , Greg Kroah-Hartman , Joe Perches Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655452742; a=rsa-sha256; cv=none; b=yvuIo/owh7Vo5juzjpKO7ksYVBPB9cylUtBH4c5K6cTvSu5D2tWS+M5iLT+y3NTLAPNm9w FCo3ou7ttJNWhpLPM3hHlgEJaDUWjSVTc6IkKWK8K71IfVvZvz81IXytNsqsqOkrU6TTJ8 WkLNAm91lo6Hr1Rc5w/YGcSFd+S+lxA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655452742; 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: in-reply-to:in-reply-to:references:references; bh=0TaGn1ZE7rwA4T26FHJ9s8LxCIwOl88lHCKLCSlYvUQ=; b=53200YOoRxuXgdDpBW8+n3P4RsxNoIc2WUvQJuDOrf0FyrGNwipf7JveSCbjDD3U9VtZ7i nElLv4IU+GfJTsXwsa49Mblam8nYDp0Rh0G2PEu7Aogs8WQV5fI4lwDRE5oqfeMAo+5qAO tXF3znUyU7WlIp3bcivT3OqF9XN/DK8= X-Stat-Signature: 1y3t168t7frauuzrggukb9qc3jzdzaoj X-Rspamd-Queue-Id: AE164800A6 Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of geert.uytterhoeven@gmail.com designates 209.85.219.44 as permitted sender) smtp.mailfrom=geert.uytterhoeven@gmail.com; dmarc=none X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655452742-594521 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi Linus, On Thu, Jun 16, 2022 at 9:15 PM Linus Torvalds wrote: > On Thu, Jun 16, 2022 at 9:56 AM Linus Torvalds > wrote: > > Out bitmaps and bit fields are also all about "long" - again, entirely > > unrelated to pointers. > > That, btw, has probably been a mistake. It's entirely historical. We > would have been better off had our bitmap types been defined in terms > of 32-bit chunks, because now we have the odd situation that 32-bit > and 64-bit architectures get very different sizes for some flag > fields. > > It does have a technical reason: it's often better to traverse bitmaps > in maximally sized chunks (ie scanning for bits set or clear), and in > that sense defining bitmaps to always act as arrays of "long" has been > a good thing. Indeed, as long is the native word size, it's assumed to be the best, performance-wise. For bitmaps, the actual underlying unit doesn't matter that much to the user, as bitmaps can span multiple words. For bit fields, you're indeed stuck with the 32-vs-64 bit difference. > But it then causes pointless problems when people can't really rely on > more than 32 bits for atomic bit operations, and on 64-bit > architectures we unnecessarily use "long" and waste the upper bits. Well, atomic works up to native word size, i.e. long. > It's not entirely unlikely that we'll end up with a situation where we > do have access to 128-bit operations (because ALU and register width > is relatively "cheap", and it helps some loads - extended precision > arithmetic, crypto, integer vectors), but the address space will be > 64-bit (because big pointers are bad for memory and cache use). > > In that situation, we'd probably just see "long long" being 128-bit > ("I32LP64LL128"). Regardless of the address space decision (we do have size_t and the dreaded uintptr_t to cater for that), keeping long at 64-bit would break the "long is the native word size" assumption (as used in lots of places, e.g. for syscalls). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds