Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1756782rdb; Sun, 19 Nov 2023 09:00:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiUkOzyH5APCkeGYhrMXy1tpfKaXpt73VwqJ8jwRFxrTExQe1Gl/yVxjZrIduzI8X8GOFp X-Received: by 2002:a05:6808:d4f:b0:3ab:8431:8037 with SMTP id w15-20020a0568080d4f00b003ab84318037mr7943680oik.32.1700413200898; Sun, 19 Nov 2023 09:00:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700413200; cv=none; d=google.com; s=arc-20160816; b=wbq2f+SQu6kIahoInlmhZNVCr1rlMGsb4QTtwhS5vCIl0QyHCfKyzpoBv0IThd8ZcS G11o9IBsiJ/5IW0JcjR2IPE0a9cDGAPa00SRSRWwvb0L/aL+xH/nNkTf+C+NY/rPQmqv ViQ63dN785UjMNNXlW6aNjrh6wS9TH4LimmnYCO8vcPyiOOeugU1Q7obkdwQ5EfHBNPG eO2lPndReCScNeMbOoCWGtOmgjPxJ9Cl5tJTx5lOekk0YLn8XmhXIvD2DmSbdy30mkqj ACncq0E5DDA+TnPtsvphK/SUbwzbXgwNCgd1MWsEb4YHMLs0UNxSdPVxmsy8IqjtWEud +EoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zTtUZUTgtHFDNv65wh+SaRP8YGXoC86zJE/tcdUO5mg=; fh=ON0oQ90Z4xnjbNCGsyMgiRbLR29nyOKvbeaw6TmRihk=; b=pdTo5Qd+H+hs8wEhpvH5WwBPtDgmgUXKwytAZRaA92FP5dJRwbQfRKDwNx0fawAIBs 8sH0EFxaGXuA8Pu5E2CcoG8b4vCPQA3xqDcdb4s8LKkX7+EmiGcrIWgsYdrrjC34oyZ4 91TNzHydcES6tS9/JwD8e6Ut+go2f/J4hR0jmrsCdm1vLqUVZOATeWhFxU5UkiPPXFdR uGjrl0cp6aQJoq12VoSC2ZzDPGjtm1u6hb4zoYmOOzcg8Ty/1fkMBP7DzRq9hsD9KpTC M7U7p0xZu9iUEMTC3AEpimqejGAHIM4jwGUDKV5r9o78IaZl3DSIVTS9mHnZysFyjXJN hBkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id o18-20020a63e352000000b005bf77518dc6si6265122pgj.286.2023.11.19.09.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 09:00:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DDC7E8060351; Sun, 19 Nov 2023 08:59:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231608AbjKSQ6m (ORCPT + 99 others); Sun, 19 Nov 2023 11:58:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231616AbjKSQ6e (ORCPT ); Sun, 19 Nov 2023 11:58:34 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E3E4010E2; Sun, 19 Nov 2023 08:58:21 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DABF9FEC; Sun, 19 Nov 2023 08:59:07 -0800 (PST) Received: from e121798.cable.virginm.net (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A20A03F6C4; Sun, 19 Nov 2023 08:58:16 -0800 (PST) From: Alexandru Elisei To: catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, rppt@kernel.org, hughd@google.com Cc: pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, hyesoo.yu@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH RFC v2 08/27] mm: page_alloc: Partially revert "mm: page_alloc: remove stale CMA guard code" Date: Sun, 19 Nov 2023 16:57:02 +0000 Message-Id: <20231119165721.9849-9-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231119165721.9849-1-alexandru.elisei@arm.com> References: <20231119165721.9849-1-alexandru.elisei@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 19 Nov 2023 08:59:36 -0800 (PST) The patch f945116e4e19 ("mm: page_alloc: remove stale CMA guard code") removed the CMA filter when allocating from the MIGRATE_MOVABLE pcp list because CMA is always allowed when __GFP_MOVABLE is set. With the introduction of the arch_alloc_cma() function, the above is not true anymore, so bring back the filter. This is a partially revert because the stale comment remains removed. Signed-off-by: Alexandru Elisei --- mm/page_alloc.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0f508070c404..135f9283a863 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2907,10 +2907,17 @@ struct page *rmqueue(struct zone *preferred_zone, WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1)); if (likely(pcp_allowed_order(order))) { - page = rmqueue_pcplist(preferred_zone, zone, order, - migratetype, alloc_flags); - if (likely(page)) - goto out; + /* + * MIGRATE_MOVABLE pcplist could have the pages on CMA area and + * we need to skip it when CMA area isn't allowed. + */ + if (!IS_ENABLED(CONFIG_CMA) || alloc_flags & ALLOC_CMA || + migratetype != MIGRATE_MOVABLE) { + page = rmqueue_pcplist(preferred_zone, zone, order, + migratetype, alloc_flags); + if (likely(page)) + goto out; + } } page = rmqueue_buddy(preferred_zone, zone, order, alloc_flags, -- 2.42.1