Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp241975pxb; Thu, 21 Apr 2022 22:56:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0ScaGEHdwFJDx2I/UZA2c1R+BX64qizCqdn1aaFOlZQ9TLYgjzpr9HrgafevXE6gzg0Av X-Received: by 2002:aa7:da08:0:b0:425:af3c:196a with SMTP id r8-20020aa7da08000000b00425af3c196amr3124501eds.69.1650606974783; Thu, 21 Apr 2022 22:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650606974; cv=none; d=google.com; s=arc-20160816; b=H37a4LSbw+wfD2w/7vzPI2gsmigfLofU6iXgc321lK44LlhoAtidbwO7BWXq9P0Kba dgOM2W70YzzW4LWo/kSUOxfwpTBfLxQdfr/eP50L8D4W8T+LntCZzcsPTuHgD4FHKOrB 8CGoS+YM2TTYwOKYQCBFX4JF0oJoypNYNDL5Pc4G+qy49FmH0cFb/xvwj8mp3+XVnSVC QRJ1ZR/n0ZqDT08nlhx4QjAMGzm80A22laY703TgMatiWWmDV6UE8i2NKkvlfoB5Vf0s vEtmeSIIyOOHGKr+4DsfQjrihx7L8Jry4jtnvhYGXz+itnW05Lukd1yqerH6jkgaUZYZ n3uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ow/im9j69K/se6X+mHhz9I/K9KFeuk4M+HHosTL3QsI=; b=AshZ9i2jSWiSyUbTjv3a5yv9Cp5MK+RIOMCyiQtcQYA3umT/tTKeDxTfa3nwRNbYxp OFaW+EBhaKSxfr4CfRAZbUoSsLEwa+c3fZhuRm/xaLoPzpMzY601U0l6sgIBCS7KsG2A Z4DtQbDtG/JlSVv/oxBCoud54GitNc4eLK+ktO62SmXUIdZBw2fT2WcTxc2rWpbq3koY FepUdTRRFAwGFO0B8CQR9tFo/KskYPM0VTEfngZSY0mtgdXeY5u0TAkFHIb0fCRRWAUZ m72PXd8GVcZZxSZfIknbHbdQo6YADsq1doTQiqPRBKWgn/Za1LxNeMwlWY1S6tr8E0OZ +iTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sLGsVw8i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a50fd0b000000b0041d79cd16d5si4880258eds.304.2022.04.21.22.55.50; Thu, 21 Apr 2022 22:56:14 -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=@kernel.org header.s=k20201202 header.b=sLGsVw8i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382944AbiDTWm6 (ORCPT + 99 others); Wed, 20 Apr 2022 18:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383065AbiDTWmg (ORCPT ); Wed, 20 Apr 2022 18:42:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1939C2BE5; Wed, 20 Apr 2022 15:39:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CA471B821C7; Wed, 20 Apr 2022 22:39:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CFB3C385A0; Wed, 20 Apr 2022 22:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650494384; bh=aOWblUPe/xTg2PyxTWlH8msgIf3I/JIiGnioyKq1k9o=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=sLGsVw8iJKIhDw1u+O84d+80f6CufGKkzbWTtkBFUOSaLA20JCvoQbxns38zq4At1 TYhoFPR679gcwj8P4yiPPuUP0XCTtaV/xzMyb36BDYDNrLDMiUZaFgcUhDsT7+KmyE hKPSrLrPO7MYLAthlU4lMSHgeaHdyfoKHIs9cLQGh4OVupBYxgMH//159jpRXbDZXq iv0Cu8P/915WVO+C2YQlkX9sQ7EODIRaGwrY0InscJCM+f+QdOLEAuNpMMsO8RDqR0 zRx2gFdKnjVuwAY1cMXHGfGfqkfoCXD5JjrmfpYzZmTaOscHiAN92G6n2C0aiTvaiZ 8/jvgCEYDeRbA== Received: by mail-oi1-f174.google.com with SMTP id z2so3720050oic.6; Wed, 20 Apr 2022 15:39:44 -0700 (PDT) X-Gm-Message-State: AOAM533fzQOp4ZGR4sO13P07MFo8KTUxKaSXd4QYr/rIzC3KbclERKIR +PgpGbgwpNQUG0y4P8LMiVVx8/8ljdtKzJYMWBU= X-Received: by 2002:a05:6808:e8d:b0:322:bac0:2943 with SMTP id k13-20020a0568080e8d00b00322bac02943mr2876683oil.126.1650494383711; Wed, 20 Apr 2022 15:39:43 -0700 (PDT) MIME-Version: 1.0 References: <20220414101314.1250667-1-mawupeng1@huawei.com> <20220414101314.1250667-8-mawupeng1@huawei.com> <672ff459-81bd-38ef-882d-e718992d295c@arm.com> <20220420152749.d41097e7d53ccd6a2a2aea5f@linux-foundation.org> In-Reply-To: <20220420152749.d41097e7d53ccd6a2a2aea5f@linux-foundation.org> From: Ard Biesheuvel Date: Thu, 21 Apr 2022 00:39:32 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 7/9] mm: Calc the right pfn if page size is not 4K To: Andrew Morton Cc: Anshuman Khandual , Wupeng Ma , Catalin Marinas , Will Deacon , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , hpa@zyccr.com, Darren Hart , Andy Shevchenko , Mike Rapoport , "Paul E. McKenney" , Peter Zijlstra , Joerg Roedel , songmuchun@bytedance.com, macro@orcam.me.uk, Frederic Weisbecker , W_Armin@gmx.de, John Garry , Sean Christopherson , Thomas Bogendoerfer , chenhuacai@kernel.org, David Hildenbrand , gpiccoli@igalia.com, Mark Rutland , Kefeng Wang , Linux Doc Mailing List , Linux Kernel Mailing List , Linux ARM , linux-efi , linux-ia64@vger.kernel.org, platform-driver-x86@vger.kernel.org, Linux Memory Management List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Thu, 21 Apr 2022 at 00:27, Andrew Morton wrote: > > On Tue, 19 Apr 2022 20:29:27 +0200 Ard Biesheuvel wrote: > > > > > --- a/mm/page_alloc.c > > > > +++ b/mm/page_alloc.c > > > > @@ -7870,7 +7870,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) > > > > > > > > usable_startpfn = memblock_region_memory_base_pfn(r); > > > > > > > > - if (usable_startpfn < 0x100000) { > > > > + if (usable_startpfn < PHYS_PFN(SZ_4G)) { > > > > mem_below_4gb_not_mirrored = true; > > > > continue; > > > > } > > > > > > Regardless PFN value should never be encoded directly. > > > > > > Reviewed-by: Anshuman Khandual > > > > Acked-by: Ard Biesheuvel > > > > Andrew, can you please take this one through the -mm tree? The rest of > > the series needs a bit more work, but is an obvious fix and there is > > no point in holding it up. > > Sure. > > I'm not seeing any description of the runtime effects of this > shortcoming. I tentatively queued the fix for 5.18, without a > cc:stable for backporting. But that might not be the best decision? > As far as I can tell, mirrored memory is only used on x86 today, where pages are always 4k. However, the whole notion of memory below 4 GB being special is a x86-ism, and so this logic does not appear to extrapolate to other architectures anyway, and probably needs more work. So definitely not a backportable fix, but just an incremental improvement, so either 5.18 or 5.19 should be fine afaict (and no cc:stable)