Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp254765rdb; Mon, 29 Jan 2024 00:44:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQ/HggnON8Ke+IwKT02eV9Rek5CzOuKXmPvw4I5AGVfhR29im0O1GIPC2fgV0odLGMRiei X-Received: by 2002:a17:90a:5d15:b0:292:b026:6aaa with SMTP id s21-20020a17090a5d1500b00292b0266aaamr1490885pji.49.1706517885391; Mon, 29 Jan 2024 00:44:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706517885; cv=pass; d=google.com; s=arc-20160816; b=IyMfRmQH6P9WdxevbuSv1rc8NwLYq/eYrur2cvuikhh3yNrmFTt/6rEZgwGBynEuCc tJny7Bxij4Dge0RQQuQGJyvJPV9Sud+5GvJf2zL5wJ+rX3jBLqEMbiDzInrwTUuwb35/ o0Jr6/H/00yiPpJN4C8wmRjjlfXdpLzluG4Vz1I6ELEs2YoeF73ighwPbaboMbz5yXDr 0qqBGIQ/NiDASM5tiNX7EczS9NUCeUw9xuPZQZ+K8d5DKrY5SsxPm5bXb6cI2WAThGeV 0W8CHCrg1L7e71cW35abNA6MZLgVvl+2uVfBycMr740B3hzpOlyqobkvfQTFHbNuXxyP Spsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=2q1xnXNc5Es/B9LTN7LHTNPlpslVsxuW+ZXikrMu+xo=; fh=XwtVEHfw5ZAP91kaI0S2jObNkwNX+knzC2DlIHJAqQs=; b=gxFL2cGjaLqpwF/cZJHkC1zMvMbSC3uD6GE7sy/xWJkA+wwZge/fRmDOENc8LE2nF1 mEyogtoySH1ZDS7hb0Cy1U0MZ1Lg8zG/g6Xj5AJBq3XEDS//oofExyHtvRJROslrBjGy nUO7NfI7f6eJXClz3Iz3zajW+sqtNzGo0zWsxJnDnWdx208ZOIPhkxCMSjO2m5Hq2bi1 W4D9lRKecKpD8dfN9O/XzieXQuTU18Cjr9/+iutDJPa9N7itWCy5PuUrjZirunN9NUib k6Gg9FqlOT5PAy4dfVSck3vO50RsxDq3kh5FO6uMTgqZXeKHVFkaYUW7RvvvxW17dCD0 y0iA== 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-42380-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42380-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 j6-20020a17090a94c600b002907e7d45bdsi5266768pjw.61.2024.01.29.00.44.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 00:44:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42380-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-42380-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42380-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 D9CF228179B for ; Mon, 29 Jan 2024 08:44:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B336C54BE8; Mon, 29 Jan 2024 08:44:34 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B8CB54BCC; Mon, 29 Jan 2024 08:44:30 +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=1706517874; cv=none; b=QK/A/pSlEnlnUDePUQUFRz5Flbr77eN/GZ4V3fUzOFw1CbYOgAUtmGld/ijoRHRDNOmHykaa9wYt0c+5C8eVPzJk1OyC3oeBE4NxdKIjwLVTYucFZ4nE0kV8qsxrmTM/c1yN1Y5Z5rLxEjSEqOayLnCewmVLStoqvdTKv8zS5I8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706517874; c=relaxed/simple; bh=MjJD+Ju24rDZFA9W3lNsMnwl/3iRcy6XP1BuXxb2O30=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ns3ZiSjbFnoTOaXaI2ry+y6OAtZ8kTBOIuLlFC3l4FDUZamzebKSAS8211cPwltgkIvsfB92xoFXCkoMhhQWWbtIy5TFdS897/mz6xYl8iF9aYdNajt3HfaTJ6GHM9m6pmie12+5YyojBWWMRqvszwTBbMCGg1QSmxLsiGaFfOI= 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 11ED01FB; Mon, 29 Jan 2024 00:45:14 -0800 (PST) Received: from [10.162.42.11] (a077893.blr.arm.com [10.162.42.11]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C240E3F762; Mon, 29 Jan 2024 00:44:19 -0800 (PST) Message-ID: Date: Mon, 29 Jan 2024 14:14:16 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC v3 03/35] mm: page_alloc: Add an arch hook to filter MIGRATE_CMA allocations Content-Language: en-US To: Alexandru Elisei , 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, 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 References: <20240125164256.4147-1-alexandru.elisei@arm.com> <20240125164256.4147-4-alexandru.elisei@arm.com> From: Anshuman Khandual In-Reply-To: <20240125164256.4147-4-alexandru.elisei@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/25/24 22:12, Alexandru Elisei wrote: > As an architecture might have specific requirements around the allocation > of CMA pages, add an arch hook that can disable allocations from > MIGRATE_CMA, if the allocation was otherwise allowed. > > This will be used by arm64, which will put tag storage pages on the > MIGRATE_CMA list, and tag storage pages cannot be tagged. The filter will > be used to deny using MIGRATE_CMA for __GFP_TAGGED allocations. Just wondering how allocation requests would be blocked for direct alloc_contig_range() requests ? > > Signed-off-by: Alexandru Elisei > --- > include/linux/pgtable.h | 7 +++++++ > mm/page_alloc.c | 3 ++- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h > index 6d98d5fdd697..c5ddec6b5305 100644 > --- a/include/linux/pgtable.h > +++ b/include/linux/pgtable.h > @@ -905,6 +905,13 @@ static inline void arch_do_swap_page(struct mm_struct *mm, > static inline void arch_free_pages_prepare(struct page *page, int order) { } > #endif > > +#ifndef __HAVE_ARCH_ALLOC_CMA Same as last patch i.e __HAVE_ARCH_ALLOC_CMA could be avoided via a direct check on #ifndef arch_alloc_cma instead. > +static inline bool arch_alloc_cma(gfp_t gfp) > +{ > + return true; > +} > +#endif > + > #ifndef __HAVE_ARCH_UNMAP_ONE > /* > * Some architectures support metadata associated with a page. When a > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 27282a1c82fe..a96d47a6393e 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3157,7 +3157,8 @@ static inline unsigned int gfp_to_alloc_flags_cma(gfp_t gfp_mask, > unsigned int alloc_flags) > { > #ifdef CONFIG_CMA > - if (gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE) > + if (gfp_migratetype(gfp_mask) == MIGRATE_MOVABLE && > + arch_alloc_cma(gfp_mask)) > alloc_flags |= ALLOC_CMA; > #endif > return alloc_flags;