Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7085058rwr; Tue, 2 May 2023 09:16:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Q7nxoeGv0hPX3h8ySdH2QERGd04arccwuZeD7mb4GtPRrF4el5ro4KhTQ1Wh1w7bv5pFB X-Received: by 2002:a17:90a:2b8b:b0:24e:26f4:4b22 with SMTP id u11-20020a17090a2b8b00b0024e26f44b22mr2744704pjd.16.1683044162665; Tue, 02 May 2023 09:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683044162; cv=none; d=google.com; s=arc-20160816; b=i0v2nO4V4N7MBLhG4G0Wcnb9PCRVVY/ZIqTTos33joiZpvMYOTtjSjmmJwFhnK6XIv v1iDqVHxPuH5mt6Vo4j/a/4fZOEs0QasZIn9pFXUb30C17Mcpu314kENOnbGhlmHNbRo 2VYiTH0btigUqBbLDT3hu4UQQ4zEM1uCSrIW8/4eMJWHaKEtkS6FLrBbDBY8yqIdvFWG 9Wsor7R/Elp2Vj9vPPO4mHUFRDkXQaVvoN+ZBO9yyc2fN0teuIJlGWXirWI4jl6wGlrF wA6Cl2CYZOrSMONXUIiOHKJQMabuslKZKQ8Pbsx+9vieVSyqQjTbO/BfWUlYSbSnty5T Pwyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=4StunhIfVGG09XAY12DZV9Q+WSw3HvDD5jZ9fqE8opo=; b=Y6u38jr9KWZVE5/vioPioeAiPi+5dD/jfzFOCqRxn2ORwN0HSFrxMn/HnTD/lU9ff/ HepxbRwGaUQ5/8hLFSXZi0foRPT78v+Lef3tO3lcustsUtezF/oXlMrFLUufUTJDF3K7 Ly/++Npu6xaw7+RKKorLtVwMErU6ktSuOJ9gPWu3uOFt84y1f17orTLa+yPKGaHL0S76 0krhY7uyOg0k0ndIZYlI4uGyY8DeL1rW7Gb/eF0gAg4PmwJ/N8E2tAGfT2NLg6wlmxLq /iAiCrTl02W7csScDNCqMY4W2HW57ew2zqSBIW59RnqjuB1Ct2T8BNngB+MWCTBqwD2C g4eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=KbV7ljsE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o20-20020a17090ac09400b00244883db2c7si31465728pjs.99.2023.05.02.09.15.39; Tue, 02 May 2023 09:16:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=KbV7ljsE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234439AbjEBQAa (ORCPT + 99 others); Tue, 2 May 2023 12:00:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234643AbjEBQA2 (ORCPT ); Tue, 2 May 2023 12:00:28 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83C7C30F5 for ; Tue, 2 May 2023 09:00:26 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-50b9ef67f35so5730741a12.2 for ; Tue, 02 May 2023 09:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1683043225; x=1685635225; 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=4StunhIfVGG09XAY12DZV9Q+WSw3HvDD5jZ9fqE8opo=; b=KbV7ljsEHPUtaLe+yaVHKpFHTeqKAG9rPmSIODIqXYaShdrCS3VOCb4EtE2fVEsskm LE+QmSvCy9SEtV3H7QGlTVeS4V66VdC1+R98ZKjc+Q3yU/+9osy8u6UJe3ZRIH+nZKrd 65D8bAXf3vZk7z9qizaXc26zwIDY8rrqMBYiU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683043225; x=1685635225; 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=4StunhIfVGG09XAY12DZV9Q+WSw3HvDD5jZ9fqE8opo=; b=Lb65wFrnM/SSzi1BjOFSueY7hnGduT5Re12zrcDV05WnqlaGX+iAuxnb2SvK8OmWas TP/x9y2mV3ysxrtml5TMjGOYzItPKElmMWXd7oPPVAhXwHcLdU/vS7Pr6TeZpVpJc57q H5bbiTktgp7pciHHrRJ03KW9uO9XTB/sGocAkXRR7675ZThCMXCzh84Q8IlOoLxUY5sQ dUCyndcwLD5UtMztWGQ7LC0flOUJ/AoOu/Mkr/srFqrXBZiLYILBtYhbcM034QapPC6X PVooVv21c2kFnC8bm6QdKUcGd43htUtWZT+Hu7aTB/fbsi4M5HPZZlJvPCZWCPKtRfIc w/AQ== X-Gm-Message-State: AC+VfDwU50dY6c/uaYRaNvcGKGDHX8vo9w21G96yQHdpWh2wAPe3hHGC mf/uQF+WfQ0426TAP+BBGjbqnbRR7Jl4RCBMgSgloQ== X-Received: by 2002:aa7:cd87:0:b0:50b:de1f:8786 with SMTP id x7-20020aa7cd87000000b0050bde1f8786mr423308edv.16.1683043224730; Tue, 02 May 2023 09:00:24 -0700 (PDT) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com. [209.85.218.47]) by smtp.gmail.com with ESMTPSA id r19-20020a056402019300b0050bc5acfcc0sm2302850edv.24.2023.05.02.09.00.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 May 2023 09:00:23 -0700 (PDT) Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-95678d891d6so823471466b.1 for ; Tue, 02 May 2023 09:00:23 -0700 (PDT) X-Received: by 2002:a17:907:a40b:b0:94e:5708:1564 with SMTP id sg11-20020a170907a40b00b0094e57081564mr442854ejc.22.1683043223131; Tue, 02 May 2023 09:00:23 -0700 (PDT) MIME-Version: 1.0 References: <20230427225647.1101172-1-dave.hansen@linux.intel.com> <20230429003822.n3mglslg666j3npp@box.shutemov.name> <641a9348-a052-6bb5-e6c7-64acb6405328@intel.com> In-Reply-To: <641a9348-a052-6bb5-e6c7-64acb6405328@intel.com> From: Linus Torvalds Date: Tue, 2 May 2023 09:00:06 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] x86/mm for 6.4 To: Dave Hansen Cc: "Kirill A. Shutemov" , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 2, 2023 at 8:42=E2=80=AFAM Dave Hansen = wrote: > > Have anyone seen any actual code generation difference between: > > return (long)ptr >=3D 0; > > and > > return !((unsigned long)ptr & (1UL<<(BITS_PER_LONG-1))); No, as far as I know, they both generate the same code. > It's longer, but I'd rather read the explicit "check bit 63" than the > positive/negative address space thing. I certainly grok both, but have > to think through the "(long)ptr >=3D 0" check every time. I'm very much the other way. I think it's much clearer to say "check the sign bit". Doing the explicit bit check means that I have to look at what the bit number is, and that is a much more complex expression. In fact, I'd find it easier to read return !((unsigned long)ptr & (1UL<< 63)); just because then you go "Oh, checking bit 63" without having to parse the expression. But even then I find the '!' is easy to miss, so you really have to parse i= t. But: > I guess it also wouldn't matter as much either if we hid it in a helper > like the attached patch and I didn't have to read it twice. ;) Yeah, I think that's a good solution. Linus