Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp79432rdb; Thu, 25 Jan 2024 08:45:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbC5PsuRob9TsLJ2t7RpQXBPQ+Iv/Rmyi5k8h+XsdnAHJLSyHqLNiFiLUUu2qFJXe/QO0m X-Received: by 2002:a17:902:a385:b0:1d8:8a3e:5eed with SMTP id x5-20020a170902a38500b001d88a3e5eedmr1182247pla.44.1706201130597; Thu, 25 Jan 2024 08:45:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706201130; cv=pass; d=google.com; s=arc-20160816; b=VYKV4Ms2Crbe9AXSxDekPKOlVFcZV6PHJRDs4Hizs9CFKllhbIze1wchZBQ/CklSeA vw/SA5JFoJgzXdKATNzD1GR1m1t4jIu6i3tpCBoweD721QpuxMxPxrbWWX9HhWq33Lh1 rzoyvMIuXvR7lZtSPHOHghRk1MKc6MSJ37F5wjN0AsghHlTWVq+QWIPs2Tt+9gsqydTa PfaTLypeLgocbEYV7k+w8enFukgbsYdGppmCcHGivPYzkdludUKe/OZlU6oZbakorU5h kY0bRpwqxsSzDcRK555ncvmQ4D/0Ry6Zb6mnZTs18uQtOGwxEg2sWsnPStOj8dhFeszN o0IA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=yCJEAk/Tce1G3ebANNHIXIwk1XBp1lyQjk0tJJyzuHM=; fh=ON0oQ90Z4xnjbNCGsyMgiRbLR29nyOKvbeaw6TmRihk=; b=Hfortr23SbaTGPSTJfd+auE8I1+gYUg8g5neXO/6dzvW+fX+1ZinovpdzLkNf5+dZf Kd+EJGBfEVDw5S7Ju8XV2+JbMkPA2+fSgRvYUe2BGSsBPfFCI4NcFtN0Orq+4dUdF7e/ iELKbZ84mxWKInlS9DROxQSDahj9ZCoUpvEIRAPdiWB5aMDhws01/rLkEp0Vkq/LO9yd N71DMJEn2AW3jKcHNIgbOa+UWD5iVwjACxeQF2GaQFu4xh6eYYMaAr7vpzkys6Q0YyI9 BKdUW/Lztayb1TpgkmEjq9Y8si/oZj32fUwf/oXMXIlNXs8PGTACzuD8pfgkEC8Gw7zy sv2w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-38917-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g22-20020a635656000000b0058974d3c296si13628451pgm.815.2024.01.25.08.45.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 08:45:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38917-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-38917-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3BCB3296091 for ; Thu, 25 Jan 2024 16:45:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37587136651; Thu, 25 Jan 2024 16:43:14 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED789130E3A; Thu, 25 Jan 2024 16:43:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706200993; cv=none; b=bhUNnwGksG+ppZZocD6AoyE+k9p4vHP5avAaWiKUc2KKtrYwPIlaGg5Pm/r0ufGKvNhmmTtkbG+2/Td4ja6P8KN7Ton57+HWd+pqlH/i3JydQLVEh2wZn8RnjAQxI2p02fyo9zxU+qdgEhyzvIN2o2vYhQLcxs4shpCaeppQkSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706200993; c=relaxed/simple; bh=L8FwdsU6xsMs5YX7ltLK2e5AAE0XBTlL9IKmoi9QVAw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U797I4sZSM/aDohn/NsXaKf4k8FO493zG2TqJo6hXIg0czH7Gb665yXpH2h/gSPUzdW5i9TEts2GapXTqyAaqStYAmw8sIqnkc70RnODKhII1RvfSSpPH6fvut6MucWHHy8ZLtZgnBlwZ0sDsRJaje/Ow4S5BtQ86SMoHtHpdNQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 B2D5A1480; Thu, 25 Jan 2024 08:43:54 -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 ADAA33F5A1; Thu, 25 Jan 2024 08:43:04 -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 v3 04/35] mm: page_alloc: Partially revert "mm: page_alloc: remove stale CMA guard code" Date: Thu, 25 Jan 2024 16:42:25 +0000 Message-Id: <20240125164256.4147-5-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240125164256.4147-1-alexandru.elisei@arm.com> References: <20240125164256.4147-1-alexandru.elisei@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 a96d47a6393e..0fa34bcfb1af 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2897,10 +2897,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.43.0