From patchwork Tue Sep 13 19:54:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 12975318 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C475ECAAD8 for ; Tue, 13 Sep 2022 19:58:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4CFA6B0088; Tue, 13 Sep 2022 15:58:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9FD1F6B0089; Tue, 13 Sep 2022 15:58:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 876BA8D0001; Tue, 13 Sep 2022 15:58:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 77D516B0088 for ; Tue, 13 Sep 2022 15:58:32 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 56C1A1C6486 for ; Tue, 13 Sep 2022 19:58:32 +0000 (UTC) X-FDA: 79908124464.30.B1D19F7 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by imf25.hostedemail.com (Postfix) with ESMTP id 0CC84A00BD for ; Tue, 13 Sep 2022 19:58:31 +0000 (UTC) Received: by mail-qt1-f169.google.com with SMTP id g12so9223173qts.1 for ; Tue, 13 Sep 2022 12:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=bjPZ9urefAsJcftBbAgQB1diXayOj809VCbylW0WU+4=; b=ElB8vGfwnTgMrOHPV8jOPMjX9e4dyOnpsA/daCy84nADITgBEDs0AWwUlYd7LmzJ4R Fd+wihlwr+eHGiOYJevIadmukrrhPQQQbV14He/EgVL8UId/ZjEQspu78E84lCBkqAk3 9AGpDbnJvnF63g83iAedqf+9zINjZ62a64qbSfO2T1vB7Ckgl7brAPRPzZAIUuLk9YsF YnnaDAUhOF2TFJBs1+hdGFIi2/6/xETSCDXaO1b95XuqZwbhceSd0bqWp4uVAOWzs4lk zAxkAToGZXGzD1zml0W1YllS9/kHr+k5y9Z8yZENt9c1+33raLf8akoDdgYfGMOxfC4A ITFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=bjPZ9urefAsJcftBbAgQB1diXayOj809VCbylW0WU+4=; b=gTa+SNwQQIvxnp43Q3haRpfAQYaej/Nz+l/Tpx8NkISU/Y8gF1eAgK2EdYK8HNu7rl IYDTjx5h0yudrmZCFIQ9x/tN2L41RznfmMCLLULm/xMM3ngy0IsnHhgW5oxbgKWnFPto eyPlhY02wkNxEe7HHafK1GsTeOQIItCbXhc7Awo3rwFrd5ELdHQ6elfpAi3IcO0WXlIY f7RYR+vVoLkzUz9922edHDPQg5GpgyC6mWZ7Q6gsNyL9BAoNj90EqWug2h4vFYyjp8Up OwMlQvbCLtP/Lq4u2WTNla06ZJzEkKz2MHhHYXGKZBs1g4lxfBLyY24Gh0nYwxCeBlP5 JrbA== X-Gm-Message-State: ACgBeo0rsj96ghpvvPmcvGBgdUKsPe2ZVfoPvpmzybxaLST1p+62DhvJ eoSPbUf/nWfOaUvq2oUsKAJAKbUN9pw= X-Google-Smtp-Source: AA6agR4w6aZMPi6cpzcCwIclFPfEwGVo8/KdfU9B4JBAlrDz19GDQ32yg1HkC6aVwcDa1gVOoM50cA== X-Received: by 2002:a05:622a:174b:b0:343:1fc:14d8 with SMTP id l11-20020a05622a174b00b0034301fc14d8mr29317121qtk.579.1663099111308; Tue, 13 Sep 2022 12:58:31 -0700 (PDT) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id s11-20020a05620a29cb00b006b8e049cf08sm276305qkp.2.2022.09.13.12.58.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Sep 2022 12:58:30 -0700 (PDT) From: Doug Berger To: Andrew Morton Cc: Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Mike Kravetz , Muchun Song , Mike Rapoport , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Doug Berger , Florian Fainelli , David Hildenbrand , Zi Yan , Oscar Salvador , Hari Bathini , Kees Cook , - , KOSAKI Motohiro , Mel Gorman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux.dev Subject: [PATCH 10/21] mm/page_alloc.c: allow oversized movablecore Date: Tue, 13 Sep 2022 12:54:57 -0700 Message-Id: <20220913195508.3511038-11-opendmb@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220913195508.3511038-1-opendmb@gmail.com> References: <20220913195508.3511038-1-opendmb@gmail.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663099112; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bjPZ9urefAsJcftBbAgQB1diXayOj809VCbylW0WU+4=; b=fnKqKJGbdgp2Meten+bKOKiJJwJBCZ4tC2rc7LlflEBW958HqyG+m2n7IeSTrnGppY2R3x 9Wb+wAVnmmNzU08NsTMBw+tOYt/RLPA2oOAgyJYDiouqTapF3Xfq2h8tCTVK1V+vGHZ4NA SEY3Igep1jp0JZNcHdIIM7PrbQJyrvY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ElB8vGfw; spf=pass (imf25.hostedemail.com: domain of opendmb@gmail.com designates 209.85.160.169 as permitted sender) smtp.mailfrom=opendmb@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663099112; a=rsa-sha256; cv=none; b=sad7pg+wO96fv2INbADjfIzQ5Q4UcBZpgTOzfpjDWgnvSmjRfU2RPzK0WKiHV9JremyYwh HeVR07a69gJuKKs8Rr1c+6a4RCexTI2Ig077DLOAC2ECNZChPakRAH0JH/lNJJp91gPeep A4Assyzbig3Ri8bvmYjOQ/8F68bJmsA= X-Rspam-User: X-Stat-Signature: rhuu7ub1e4m34qn68nzxdfotkdodszg4 X-Rspamd-Queue-Id: 0CC84A00BD Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ElB8vGfw; spf=pass (imf25.hostedemail.com: domain of opendmb@gmail.com designates 209.85.160.169 as permitted sender) smtp.mailfrom=opendmb@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam08 X-HE-Tag: 1663099111-590146 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now that the error in computation of corepages has been corrected by commit 9fd745d450e7 ("mm: fix overflow in find_zone_movable_pfns_for_nodes()"), oversized specifications of movablecore will result in a zero value for required_kernelcore if it is not also specified. It is unintuitive for such a request to lead to no ZONE_MOVABLE memory when the kernel parameters are clearly requesting some. The current behavior when requesting an oversized kernelcore is to classify all of the pages in movable_zone as kernelcore. The new behavior when requesting an oversized movablecore (when not also specifying kernelcore) is to similarly classify all of the pages in movable_zone as movablecore. Signed-off-by: Doug Berger --- mm/page_alloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b6074961fb59..ad38a81203e5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8041,13 +8041,13 @@ static void __init find_zone_movable_pfns_for_nodes(void) corepages = totalpages - required_movablecore; required_kernelcore = max(required_kernelcore, corepages); + } else if (!required_kernelcore) { + /* If kernelcore was not specified, there is no ZONE_MOVABLE */ + goto out; } - /* - * If kernelcore was not specified or kernelcore size is larger - * than totalpages, there is no ZONE_MOVABLE. - */ - if (!required_kernelcore || required_kernelcore >= totalpages) + /* If kernelcore size exceeds totalpages, there is no ZONE_MOVABLE */ + if (required_kernelcore >= totalpages) goto out; /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */