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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA713E7C4EC for ; Wed, 4 Oct 2023 18:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244406AbjJDSee (ORCPT ); Wed, 4 Oct 2023 14:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243805AbjJDSed (ORCPT ); Wed, 4 Oct 2023 14:34:33 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C548C0 for ; Wed, 4 Oct 2023 11:34:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE9F4C433C7; Wed, 4 Oct 2023 18:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696444470; bh=Y3YZpOqClP48uKhu7HzHVi1Q/19yLoRxUDopOUGnCmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E+FEnwYfk7PjhdWdWw0K1/v0HPr7xxnCyM/BqCceGrsFRYwiW0UO7m4/0B6lxW8M6 ddTXT5JCPtH8GgYmSzeEKODUYlb57uHm/OmrOkUiKrJgYD2SMsfM60WBScdK2cdVbU gJQ9vpPtusgtDQiSFoFfsVtOXhpVqRrBEW+/h+JA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chong Qiao , Huacai Chen Subject: [PATCH 6.5 261/321] LoongArch: numa: Fix high_memory calculation Date: Wed, 4 Oct 2023 19:56:46 +0200 Message-ID: <20231004175241.347006666@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231004175229.211487444@linuxfoundation.org> References: <20231004175229.211487444@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Huacai Chen commit 1943feecf80e73ecc03ce40271f29c6cea142bac upstream. For 64bit kernel without HIGHMEM, 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 for high_memory 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: Fixes: d4b6f1562a3c3284adce ("LoongArch: Add Non-Uniform Memory Access (NUMA) support") Signed-off-by: Chong Qiao Signed-off-by: Huacai Chen Signed-off-by: Greg Kroah-Hartman --- arch/loongarch/kernel/numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/loongarch/kernel/numa.c +++ b/arch/loongarch/kernel/numa.c @@ -468,7 +468,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(); setup_zero_pages(); /* This comes from node 0 */ }