From patchwork Wed Sep 28 22:32:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 12993203 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 5861DC6FA82 for ; Wed, 28 Sep 2022 22:33:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E8D436B007D; Wed, 28 Sep 2022 18:33:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E3B656B007E; Wed, 28 Sep 2022 18:33:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB5356B0080; Wed, 28 Sep 2022 18:33:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BB2726B007D for ; Wed, 28 Sep 2022 18:33:56 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7B532120A8B for ; Wed, 28 Sep 2022 22:33:56 +0000 (UTC) X-FDA: 79962948072.05.503EB65 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf19.hostedemail.com (Postfix) with ESMTP id 09FBD1A000D for ; Wed, 28 Sep 2022 22:33:55 +0000 (UTC) Received: by mail-qv1-f41.google.com with SMTP id p3so3502481qvz.6 for ; Wed, 28 Sep 2022 15:33:55 -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=Y1gY+TTTvQU628l9QGecp/PtNkThqCYkuVMTpcWzNvU=; b=BqYh+xbtP+MiEfognlviz93t2UYTYbdkBqOta6P6qz05hPu2VXyNpJC6ZPNULV48aV R7ix3iOWaCRHG86HGLxJOkOqX/k5tkF1yhFvp7trfzvr0tkFqw6il3mSg1zFJq9cGzrl o6my3cBgPsq0pFc3Ib7FFLp9Ce+8nvoZVzr+yWG/M+XojQe2YfkMiMH2x48UuO+Jq0kf LySWCGNlbEk6r/C2v8x/crAodPNpp4U5MuIaDgbMfYbRraHdNmJMNeg3sA9TnaNV5H6B 3+tTIPJ7STDIM6FZsrlOKaKFPsGy72ghWhyrMA3E0+WLnlE1E5MXJip0lp+GLAdIqCIm yCkQ== 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=Y1gY+TTTvQU628l9QGecp/PtNkThqCYkuVMTpcWzNvU=; b=xTfzu461KNqV7SKCkFkDq9xg4FTP/qxHEGcoD1S0c36eiZvzWBlqS3aAkll9Jj9Gg6 Dgvd7lCDTP7zHWHjwYKfZxM7qFDaVrpLobZY6WGkdUQvjGG2HH14Dut/+40jijYvWe34 DOapKXGRUmas+UY8pjq1IXsK+FzLW9qJTk4wJrwgdDrhr2LczXYdt/wN8VLYGukCCBzi a1rpznLygvlOM7acHc4hXFGHthJiQ18HCSchAoC3FaAc0U0chCYDDxfIZtGrWTdJmPVt g6PmItb8dcvKDCNe0zHzcZ9vf7zIoZGiulrARyJ2bcgpgTkItbEAiMXdha0G5+qiWcoX ARRg== X-Gm-Message-State: ACrzQf1h4iG2S03kfuK9vhsua1b9aFNx1x81oUAfhkNa7v5HusGvjEZe Ppcha4A6NkPddvgl9XpU9xo= X-Google-Smtp-Source: AMsMyM7sRRj9qRUG7RZy9MMEt2bnHdiX8XuLyY5K1L0DMOgv9jkZopsYpvfjf6WZb2+cG3qtbuVi9w== X-Received: by 2002:a0c:9a4c:0:b0:4a4:3ad8:3c28 with SMTP id q12-20020a0c9a4c000000b004a43ad83c28mr205895qvd.124.1664404435298; Wed, 28 Sep 2022 15:33:55 -0700 (PDT) Received: from stbirv-lnx-3.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id j188-20020a37b9c5000000b006bb83c2be40sm3963481qkf.59.2022.09.28.15.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 15:33:54 -0700 (PDT) From: Doug Berger To: Andrew Morton Cc: Jonathan Corbet , Mike Rapoport , Borislav Petkov , "Paul E. McKenney" , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Muchun Song , KOSAKI Motohiro , Mel Gorman , Mike Kravetz , Florian Fainelli , David Hildenbrand , Oscar Salvador , Michal Hocko , Joonsoo Kim , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Doug Berger Subject: [PATCH v2 4/9] mm/page_alloc.c: allow oversized movablecore Date: Wed, 28 Sep 2022 15:32:56 -0700 Message-Id: <20220928223301.375229-5-opendmb@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220928223301.375229-1-opendmb@gmail.com> References: <20220928223301.375229-1-opendmb@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664404436; a=rsa-sha256; cv=none; b=uiqeY6I5+PXEc5fq0slVoTnFWGnLxyqnX/+cJX6QdPCEn8TkgSDPdTnUW3ESZtGqm2T1+O AIYZwWfE6GjlKqyzRolTJtiNLwbIV45x6BvF+xaqNDB693kRIoAmFRnmSXNnIRFovUd2kb 9Xu9JYK49qHNEAWLntUMbbBo17MCu4Y= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BqYh+xbt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of opendmb@gmail.com designates 209.85.219.41 as permitted sender) smtp.mailfrom=opendmb@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664404436; 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=Y1gY+TTTvQU628l9QGecp/PtNkThqCYkuVMTpcWzNvU=; b=bpquwiOHrTNb1V0u0Ck4gXWLR5gK/dcRlTh95wNd/d9B2vdLrHi/d8WjmsXBjW/oxaapSB SVpMNhdOJdwNRKmYsar1s4+nlCQqhhmKhGpwubQ53/YlYC0gVih9OnZfYzODwrmEkVYmqu whd0RrckoYWxROTmH/p+1OgbNrlSEOM= X-Stat-Signature: 9i4cgdjic471apgksayqpsa9uxa3j4nk X-Rspamd-Queue-Id: 09FBD1A000D Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=BqYh+xbt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf19.hostedemail.com: domain of opendmb@gmail.com designates 209.85.219.41 as permitted sender) smtp.mailfrom=opendmb@gmail.com X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1664404435-360908 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 3412d644c230..81f97c5ed080 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 */