Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2228512rdh; Tue, 26 Sep 2023 17:26:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFO+4HhkI7jVJEIRa47IdohuzFNjacssNnnFwqjrJ1Z55T+HFshVhfcaYdjw6wF9MIUx/M8 X-Received: by 2002:a05:6a20:551c:b0:14d:7b6:cf2f with SMTP id ko28-20020a056a20551c00b0014d07b6cf2fmr370340pzb.47.1695774398737; Tue, 26 Sep 2023 17:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695774398; cv=none; d=google.com; s=arc-20160816; b=wMBx6jRLyvRP/VnLup03ECJIVs8T3gs+uTBv39RpMnndjxUT8Pb8mARndG9Idb56xY fQ0b2OZWwKBOeHYpk4hp2hYRlmuKBB8865C2OgFpXtjP0NBbAC3OusUsTxduh+05DDn6 HNzpnDYDAMIK8Yl+oHmjGg7Lf5UPI+/QsSUjDlz+VAiabrOs0iDHEkWl5BkKNmQRFwgy WqelSiDiSVsLTi4TTcXk+q+uwJq8RaOP4YJ4bPcE1vpp+sM7T7GFhv5+aLXJ5+5PoXgV Hiy0uOUWopsOZlkbiajjUc64mhWAJO+lJSp7YvA43wBQ++Iz30xm7+UCcMqNLTkaKa3F 8eIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=HLA6p4hDqLc3qvKRi0h4gH1K/5WXd243lLkAo9sfTeM=; fh=pjU2Sh1fml/YL1c8ypfKwDyh7kHT0vBjLK9Ae8mpxDY=; b=oBXK1kr9rpw4i+MYE694VPU0eYehGW3QHkeJrAVL3T/XbB1CrcMqhE0e46q8RDrtdT gN/Jm7ViIrLaEE1joOvrdSr1ND7LL9MdXsLLWF3kdRqpCEvpI2FtCeivTBif7YesRPoD aY4vWVLlFO8heWzoP9qQKGnv25AfWnksuyLDXSHHuYZUsXlzvClyOEzcUp0aPPd60jqN AMGbaUNkEAkf7HRgvWSEG1gA+GzkmTSuM0h9Rlyhqr0+9lBxJJAjRTGpARBq7DSmwB5c /D8otvn+6HGlGp79vWloU+LkQHWHeIkgmyw94zGq5WwIIwefy3ZIc9Eng0cRRLcNcURX h+vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=dkRllyLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00578d0cef09csi13730241pgb.234.2023.09.26.17.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 17:26:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=dkRllyLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 191068065831; Tue, 26 Sep 2023 08:27:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234902AbjIZP1T (ORCPT + 99 others); Tue, 26 Sep 2023 11:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234986AbjIZP1R (ORCPT ); Tue, 26 Sep 2023 11:27:17 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2DC0124; Tue, 26 Sep 2023 08:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1695741991; bh=QsqRgvKUnL6W0NEHrtVeuczEAWjiUjF19Ug8WTjaTXE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dkRllyLpdnpiqce7rLwaswg120DWfCzh/EDuHTOHdQSkNDgloICRzpypSge7K6Ljr B7rDry8mGd/OtmEqvoCiZoUL4HjortUwuXJAqnQIF94l8jqQjqXSpN3ytFfZhojO6v IWn5Nem208jOWslFl47iaXp7DvBBnc/q8VJr1YsA= Received: from [IPV6:240e:388:8d29:7200:439e:6305:2d94:4764] (unknown [IPv6:240e:388:8d29:7200:439e:6305:2d94:4764]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 5A225600B5; Tue, 26 Sep 2023 23:26:31 +0800 (CST) Message-ID: <4abf8ddb-ff93-436f-a834-39e7f4d7a503@xen0n.name> Date: Tue, 26 Sep 2023 23:26:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] LoongArch: numa: Fix high_memory calculation To: Huacai Chen , Arnd Bergmann , Huacai Chen Cc: 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 References: <20230926121031.1901760-1-chenhuacai@loongson.cn> Content-Language: en-US From: WANG Xuerui In-Reply-To: <20230926121031.1901760-1-chenhuacai@loongson.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 08:27:19 -0700 (PDT) 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(), which > 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. > 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 = (void *) __va(get_num_physpages() << PAGE_SHIFT); > + high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); > memblock_free_all(); > } > -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/