From patchwork Sat Mar 11 00:38:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 13170541 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 DD78DC6FA99 for ; Sat, 11 Mar 2023 00:40:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45B138E0006; Fri, 10 Mar 2023 19:40:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E2B98E0007; Fri, 10 Mar 2023 19:40:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25CFB8E0006; Fri, 10 Mar 2023 19:40:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 13C886B0072 for ; Fri, 10 Mar 2023 19:40:01 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DC06F1C5E7D for ; Sat, 11 Mar 2023 00:40:00 +0000 (UTC) X-FDA: 80554760160.07.7C6BF86 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by imf17.hostedemail.com (Postfix) with ESMTP id F177040005 for ; Sat, 11 Mar 2023 00:39:58 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VF08Okgd; spf=pass (imf17.hostedemail.com: domain of opendmb@gmail.com designates 209.85.219.51 as permitted sender) smtp.mailfrom=opendmb@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678495199; 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=YS/BwpEuHX62q7q4jA6kz2JjH38ryXLVzKB9Q24XSVc=; b=GR+7t/+l/ZlyaqtBDKYMJd7VtqMdQMXcAsc3hUwRPZf5Ua5LEZ/gkbl0irLVDUMdU3KHcM GsyD3Yb5NuakK9Kopr10mzh48GDSl7uRsGm1l5/SUyXmzY7JLBw1NUFRuat+jbg06N9f3W /08Hj03VcRAkaNJusM1xYjGpQkjhrmE= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=VF08Okgd; spf=pass (imf17.hostedemail.com: domain of opendmb@gmail.com designates 209.85.219.51 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=1678495199; a=rsa-sha256; cv=none; b=zlaOa6RqAe6y17zcpXknj9VF8BmEzBZp+FcdUZUZ42Ji8/hPu0FQJNGX+Mf0FEhySMB8Um YdnTvPO4MNTUbsvsyqWjgdoB2BWx2xu+wMevGDuBw4HdAjCmDrOK310gCR6eRUJaRKs0I3 BENytmHgqVaygZnIqLhh/uTpRyNSMBI= Received: by mail-qv1-f51.google.com with SMTP id ne1so4751583qvb.9 for ; Fri, 10 Mar 2023 16:39:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678495198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YS/BwpEuHX62q7q4jA6kz2JjH38ryXLVzKB9Q24XSVc=; b=VF08OkgdvcCe08OFIcKq9AjNHxoLhzwun0cGIC1Dw+CHTXLxKUFwhYo6TUZdd/cWK3 9WanLdPXxSvDlWj9fqkxau3KxElLZQ+s/76QZ3bxEmG1O+nywfnvT/hiRGlxMPH/ohYJ FAs5zCI3FPjJgsi5FN6DhqLP9JB7Lpvd8rZj/E499x6+NukAtPbth8cSZITIIevW4iJI mpXPc4PbQsDfArMwZv6d+gaXpvtIkJexpGmEU7Bh54jzSPLoRC8gA+96ufZ6AQFCWzAo aZF9vOT02zcYSfbZLxIu9rZCY/Z3v8Xnipykl3H10Lw3vvS3h3NOz85H7iNEhWMQD/d4 eWTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678495198; 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:message-id:reply-to; bh=YS/BwpEuHX62q7q4jA6kz2JjH38ryXLVzKB9Q24XSVc=; b=vtaqAgPC8bfVRzb+HJa2wsKMqdpn/SnRAInVUNKssWgkzMiOjdxt+jpZ1z0K4CIumw nudbo+IMqqCPuHyCKkRy3ZVojvXWpY97v5SjE4tC1RnjTZlobDsGo/qXwyJ/zW1tZfjl KYSLVJFqsuiLNXTZC098FdHcHljtheyrQzJSH42TorB8T2Yk3oV4pSlJfcYsqpk1adtJ VdULlNdgZoyl2W45mrZ5e0Bn1fnN/uXUftvHn6x68V0xEshoCuh3CvedGZspPizABMY4 +cufjObT7DFCwLCc+Jo3x/8VJTnwVv22kUvz+FdHPIRHJPbiWFjiuG27PNtN24aZiszL aplg== X-Gm-Message-State: AO0yUKW4U00BkekISHUM/84+zF7t5kqXyqvSGoHR8bS6rUfPkLDpdXG+ AAwqjvTP3/GHzw2aAyXbtqI= X-Google-Smtp-Source: AK7set/7lbmUehkOoWsoZelfJbwaie1c7mWXavPmCpQDq6lJJf0+Kbe53vrmeRB0vmNfXKniiuy2zg== X-Received: by 2002:ad4:5aee:0:b0:57e:56f5:5410 with SMTP id c14-20020ad45aee000000b0057e56f55410mr1647846qvh.39.1678495198141; Fri, 10 Mar 2023 16:39:58 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id a5-20020ac84345000000b003bfaff2a6b9sm868874qtn.10.2023.03.10.16.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 16:39:57 -0800 (PST) From: Doug Berger To: Andrew Morton Cc: Jonathan Corbet , Mike Rapoport , Borislav Petkov , "Paul E. McKenney" , Randy Dunlap , Neeraj Upadhyay , Damien Le Moal , Kim Phillips , "Steven Rostedt (Google)" , Michal Hocko , Johannes Weiner , Vlastimil Babka , KOSAKI Motohiro , Mel Gorman , Muchun Song , Mike Kravetz , Florian Fainelli , David Hildenbrand , Oscar Salvador , Joonsoo Kim , Sukadev Bhattiprolu , Rik van Riel , Roman Gushchin , Minchan Kim , Chris Goldsworthy , "Georgi Djakov" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Doug Berger Subject: [PATCH v4 4/9] mm/page_alloc.c: allow oversized movablecore Date: Fri, 10 Mar 2023 16:38:50 -0800 Message-Id: <20230311003855.645684-5-opendmb@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230311003855.645684-1-opendmb@gmail.com> References: <20230311003855.645684-1-opendmb@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: F177040005 X-Rspam-User: X-Stat-Signature: 5has61qa6acb97xit8xqfhzizekh3y7m X-HE-Tag: 1678495198-392013 X-HE-Meta: U2FsdGVkX1+COCSeAOlvXvShyixY0U3pE171p0Ba0D7+fd/wlKww0XrYWGeU+fvqVNKhFzrc9GHMSfvKG+ZQBTHF0jj7MoPdFs14ZVtdOSFmRavcnvsosE2bTRX71u7XlvHmQkWNgyBGPWoDAnUMlhsc8jbAsSoS0mL0XjDl0V5dH6HfvNVBrWMhDsUsnrOnUtRNMOXsKHW3jtFU6eMiiaBCfWm1BgPt/wd7zqtqmSPkLLPLlt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hiV2UDEwfBU1KLOOfDRJtn1iEQH9dPEWwy5SgsEiuR+8FGF7CO3OH/PcWhF8r16U0jwbaeRXqC5rNuSHS5iNB1y7KrqJfpF+jp2PGZpHj2nnhhgmZ1JVuKCniI5PK8Bnxytxc63mIv9R9NifJGfGXvpG/tyOWG7HLsBQjEcJmIvrG3Wy+QLRUErVcfIM71Rd3FsfKGvmHahSNRXraDn4pug+85xy5lG6HbuxeNj3viORaUONlGGbFALs71hur3hyMQsX1QEDQ= 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 827b4bfef625..e574c6a79e2f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -8166,13 +8166,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 */