Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2288458rdh; Tue, 26 Sep 2023 20:09:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9ern0Wipn+kpyQPhuVd1fidzb7sZNEokE35L2TJHEhW4FGZ6syFhKHAX/XAnj5FyT4H57 X-Received: by 2002:a17:90a:68ce:b0:263:f521:da3e with SMTP id q14-20020a17090a68ce00b00263f521da3emr1296172pjj.2.1695784143181; Tue, 26 Sep 2023 20:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695784143; cv=none; d=google.com; s=arc-20160816; b=uYW8IlhBH57vT+kj4e29gd6ZfwyH+hkVtFtkpkFwQTC2MOBIwhXIoL6CyuiKQSJBZ5 UltmMTzGZnXvQ8HVFbbsiiwdpU59d6S0Q2+6T1Lsg2IScBXIIrjnyzOpweC+7UIpcpeE XLUrmkHBkxSlD5q5jOi/15iQtdHKLapJ6CFv+02lGqZZTxpCblvfY+ee3Nd05A/hE91Z TL4DMFSFS4u9EdVmMHq9m8FlaKiMAWMvjztBnO1VsPsmIOnjx3Do8x/amsrF6jUPj53p SxSGmZps6f5MQsG80p5AgLSdC5FXv/FUZYk5gWXXTQmxBN2muk1HlYImk9+0Ff+ORAW1 nsZw== 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=XSRQxWIatDTPtkiqzEF922dr6Olz8iNMdJ2qT2GhsVs=; fh=1dzwGmDcRG7PlEUfuN/CVIaMnpkwotX2LWVd+Yutlqg=; b=qivZZ/AoMk60wV7UGgQCcF/LlNgNX/bTqViZ6RJLrCW2kr+nQR5lTLCATU9rJf2Y9m uRwbfwunG+J9NlaTNYsiRgro+iRWeVxw7wG/5g/F/XYvxzWGAIo11wUpVLRFYqzAwdeP KoPVxRUZ261EPODNDVrpOT/xbs2/4afYKP22S5ZECP5NonF1LCLd9BVY7x43eeovjvcL RXlOEuyI6gB3hjVH8As93Lqk9pZulM3RdB30hSIPR6kiVEYqg96luaOM5VwYVoHfJaL5 4xTrA3mMawaiI9KIIHZ9GomhCRw+XelUigoKr9jjicuMq3yPfs3+e7ruNEbrtNFM6jv/ HkKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="gNE3/ylO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id mh7-20020a17090b4ac700b0026822221502si16133387pjb.163.2023.09.26.20.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 20:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="gNE3/ylO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id EB3D081BEE86; Tue, 26 Sep 2023 20:04:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbjI0DEx (ORCPT + 99 others); Tue, 26 Sep 2023 23:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235293AbjI0DCv (ORCPT ); Tue, 26 Sep 2023 23:02:51 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19A976B2; Tue, 26 Sep 2023 17:45:41 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4528EC433CB; Wed, 27 Sep 2023 00:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695775539; bh=2czlUODplVLqlPwrGiCVrixmp6cbiBPmEv+rpDMNXbE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gNE3/ylOvhRAAoz/vsvv9pN5ZobXtP1piV0MjWp1L0UZj699jNMZbSqPNIug9aveo EXIR25LqshXk+WtroxcOWzrX8sHUzX+k3t/iTkQb+0n4hSJqcQBpyIvyXfu9I/C4qo 9Zcm00JBw0DvFNlOAz8fWYvCC6GGgCZEazaYZbI4zHTzyIbKvT4Zq2Gka+8StvxJbm v29idUfwAetZBi/R+2RCOPbQnmrZa09PJdhkBCs59xhijWkwu3iPnjtNfdBBwFsRss 5a1oyOE+sSaJlNVxR/r5r6JsojfIp8MQYqDhtGqcBdm7bx+thdBaWvs1SwDfT2zeNm JIGs47bCHE4wA== Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4053c6f0e50so94643995e9.1; Tue, 26 Sep 2023 17:45:39 -0700 (PDT) X-Gm-Message-State: AOJu0Yx8stZjqNN2cxNj12+4RuiCBQlvRdYPKhR+B4BsTiAYy4yxzfU8 3Y1ofQQin7Q4dEyq4ZjQx7zutu8yBik1zCTt5LY= X-Received: by 2002:adf:ecce:0:b0:31f:98b4:4b62 with SMTP id s14-20020adfecce000000b0031f98b44b62mr229081wro.37.1695775537680; Tue, 26 Sep 2023 17:45:37 -0700 (PDT) MIME-Version: 1.0 References: <20230926121031.1901760-1-chenhuacai@loongson.cn> <4abf8ddb-ff93-436f-a834-39e7f4d7a503@xen0n.name> In-Reply-To: <4abf8ddb-ff93-436f-a834-39e7f4d7a503@xen0n.name> From: Huacai Chen Date: Wed, 27 Sep 2023 08:45:24 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] LoongArch: numa: Fix high_memory calculation To: WANG Xuerui Cc: Huacai Chen , Arnd Bergmann , loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, stable@vger.kernel.org, Chong Qiao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 26 Sep 2023 20:04:58 -0700 (PDT) On Tue, Sep 26, 2023 at 11:26=E2=80=AFPM WANG Xuerui wr= ote: > > On 9/26/23 20:10, Huacai Chen wrote: > > high_memory is the virtual address of the 'highest physical address' in > > the system. But __va(get_num_physpages() << PAGE_SHIFT) is not what we > > want because there may be holes in the physical address space. On the > > other hand, max_low_pfn is calculated from memblock_end_of_DRAM(), whic= h > > is exactly corresponding to the highest physical address, so use it for > > high_memory calculation. > > > > Cc: > Which commit is this patch intended to amend? A "Fixes:" tag may be > helpful for stable backporting. OK, I will add a Fixes: tag. Huacai > > Signed-off-by: Chong Qiao > > Signed-off-by: Huacai Chen > > --- > > arch/loongarch/kernel/numa.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/loongarch/kernel/numa.c b/arch/loongarch/kernel/numa.= c > > index c7d33c489e04..6e65ff12d5c7 100644 > > --- a/arch/loongarch/kernel/numa.c > > +++ b/arch/loongarch/kernel/numa.c > > @@ -436,7 +436,7 @@ void __init paging_init(void) > > > > void __init mem_init(void) > > { > > - high_memory =3D (void *) __va(get_num_physpages() << PAGE_SHIFT); > > + high_memory =3D (void *) __va(max_low_pfn << PAGE_SHIFT); > > memblock_free_all(); > > } > > > > -- > WANG "xen0n" Xuerui > > Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/ >