Message ID | 20230926121031.1901760-1-chenhuacai@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1862793vqu; Tue, 26 Sep 2023 05:12:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6SfBgSd/4T1vkqA2MBHKyfZP/NpVVTqAMVGM1DxKyLKUUg4I5pnPbiXoX/qE1z49B0D2i X-Received: by 2002:a17:902:e888:b0:1c5:d063:b72a with SMTP id w8-20020a170902e88800b001c5d063b72amr9281503plg.27.1695730336897; Tue, 26 Sep 2023 05:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695730336; cv=none; d=google.com; s=arc-20160816; b=Ebu12BqxsCvxIQxKIJ6Fm/VU3pthWll6Wu+PM7Jd4f7UULSbfcw8lb9IIq6t8EkrRc sFkP9DsSOAl9++/kPz9qJ0aYkoFHIOheZsdcT62IlTq6eULmrnMjiBBZ0cdSvJy7nqgQ 3Rc90CMyWvObIuK5dCPVlfaHs/EhD47fse6UMKq9/mJuyjRCBmXekzjwsE/7vedDjIcu 7pAnAdak6j0VuTn8nwywtSR0Gwg5XwnUXBdJO7iJdqg/TjY8OJ0bSsq+jWND79tD9Qjj kc1TAGUJiXxFlk6TEKK1H3sfsQAJ6KNncVjnh24Ew6s79W2HhzpDhNTxMMS1gteFVr7o XpVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=TJSw/TZm4IXSjiH+N6IvV6fjbang/cpC3BCGa8UpJqw=; fh=w0HqZQH+LVeyaZnAul4E/a2u3mVPqUHxdfbQabwvRps=; b=HR1NTxUraKiAYFl63Jz18pBsOPTn/BDAsqRuQPNCwUUFjbXn7bCepnr2UNWTAyECne m8fdS27dFzidV3+1/dSFAMdO+zqULcmjCIPDRyGMXJLHgSwm5+4rIi53b2VAPS9XfGyW ZxnjPCYfLmQeWPEaW7JghmSwY0Hs1POfkNVJ3idUdHGY1dHPuA6r+m4c9uCziQH3xrh4 xv3+yLumWHkaVz67Qm92dfqvy5O7+amZfWOTSGLSX6sQYFCjfaLpI8LXoQMcCho1zZhp vUB84y5pNZaLpKQnGtqtBJicYtak92bAkJbXVhJg5a8Dvn+jMvKjsKi2Op+rnhiD0M7/ qn+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id z4-20020a170903018400b001c611f285a3si5825042plg.605.2023.09.26.05.12.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 05:12:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 4189F82B9289; Tue, 26 Sep 2023 05:11:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233219AbjIZMLC (ORCPT <rfc822;ruipengqi7@gmail.com> + 27 others); Tue, 26 Sep 2023 08:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjIZMK7 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 26 Sep 2023 08:10:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AB29E6; Tue, 26 Sep 2023 05:10:53 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACDDAC433C7; Tue, 26 Sep 2023 12:10:49 +0000 (UTC) From: Huacai Chen <chenhuacai@loongson.cn> To: Arnd Bergmann <arnd@arndb.de>, Huacai Chen <chenhuacai@kernel.org> Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li <lixuefeng@loongson.cn>, Guo Ren <guoren@kernel.org>, Xuerui Wang <kernel@xen0n.name>, Jiaxun Yang <jiaxun.yang@flygoat.com>, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen <chenhuacai@loongson.cn>, stable@vger.kernel.org, Chong Qiao <qiaochong@loongson.cn> Subject: [PATCH] LoongArch: numa: Fix high_memory calculation Date: Tue, 26 Sep 2023 20:10:31 +0800 Message-Id: <20230926121031.1901760-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 05:11:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778102134141365333 X-GMAIL-MSGID: 1778102134141365333 |
Series |
LoongArch: numa: Fix high_memory calculation
|
|
Commit Message
Huacai Chen
Sept. 26, 2023, 12:10 p.m. UTC
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: <stable@vger.kernel.org> Signed-off-by: Chong Qiao <qiaochong@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> --- arch/loongarch/kernel/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
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: <stable@vger.kernel.org> Which commit is this patch intended to amend? A "Fixes:" tag may be helpful for stable backporting. > Signed-off-by: Chong Qiao <qiaochong@loongson.cn> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > --- > 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(); > } >
On Tue, Sep 26, 2023 at 11:26 PM WANG Xuerui <kernel@xen0n.name> wrote: > > 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: <stable@vger.kernel.org> > 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 <qiaochong@loongson.cn> > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > > --- > > 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/ >
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(); }