From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1638359F90 for ; Wed, 14 Jan 2026 07:19:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768375146; cv=none; b=oqhb0aYqkvRYE8beuQPsFpcGcQIoLWSjaqoempOTSxTxTYzK7uYsBgxyExDe3/vwpTHzJaZCiaxl0pfURVfDmrelnOoHYv0E62yVK9csUG7B+KhJ6OToianXVveEy/mtrru7mKK33HHsODKTaSHXqahbBcXXgKKrJ2hreq5EQU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768375146; c=relaxed/simple; bh=hVqqVaXS0GeC6kx6LwQASUNzGa6n/+1fT3TSbae2KTk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=snLNcIf9YSKT7g1jXmk1B3NSBfYaPUCKz53GQETqt/Iql5Im+jmU4fGqXSQIKGd6zGOxkINDc1tSO/3owtvCSr86iJZu4XhAPKJVgcKFb8eq6xo8eG6cw6IX+hUT6KRnCaltFQ46KsdZ8boYMP4UlIqiOiLFi3FQeGPBHdFONy0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PH4+1cFm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PH4+1cFm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 383E8C4CEF7; Wed, 14 Jan 2026 07:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1768375146; bh=hVqqVaXS0GeC6kx6LwQASUNzGa6n/+1fT3TSbae2KTk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PH4+1cFmqZ/jJP7uMNmA5XJANrv6IfwGkL1odjcuxuUkQH9mSNFKVFN0GFtw+IZzG wUxxpTxKqddekHhX1oGIfA0PqGMsDz/HIRRQf7DVPy8ESy1k9Tsb+5c0D6deWnCtTh /fNTtBtldbwUQ+3KIYsoJOV9AHo7mILOA29PwyD2GM2MyZVMDv/4vF38bqBfJCe6i8 UtI9kLeHLKePSFRKLB21jcvoItIYLKWGXQWvWISsGJtrJiLNxtyYGwWZcGT77xJIhW NDl/3azjt90J7Gaiw22jkjmdLyDZunupBZMIeQLkb12D3L6DV6T5XfGA1HsFRDbimY RSq5bunYFIMyg== Date: Wed, 14 Jan 2026 09:18:56 +0200 From: Mike Rapoport To: Robin Murphy Cc: m.szyprowski@samsung.com, akpm@linux-foundation.org, vbabka@suse.cz, david@kernel.org, bhe@redhat.com, iommu@lists.linux-foundation.org, linux-mm@kvack.org, vladimir.kondratiev@mobileye.com, s-adivi@ti.com, linux-kernel@vger.kernel.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, surenb@google.com, mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com Subject: Re: [PATCH 2/3] mm_zone: Generalise has_managed_dma() Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jan 12, 2026 at 03:46:37PM +0000, Robin Murphy wrote: > It would be useful to be able to check for potential DMA pages beyond > just ZONE_DMA - generalise the existing has_managed_dma() function to > allow checking other zones too. > > Signed-off-by: Robin Murphy Acked-by: Mike Rapoport (Microsoft) > --- > include/linux/mmzone.h | 9 +++++---- > mm/page_alloc.c | 8 ++------ > 2 files changed, 7 insertions(+), 10 deletions(-) > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index 75ef7c9f9307..fc5d6c88d2f0 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -1648,14 +1648,15 @@ static inline int is_highmem(const struct zone *zone) > return is_highmem_idx(zone_idx(zone)); > } > > -#ifdef CONFIG_ZONE_DMA > -bool has_managed_dma(void); > -#else > +bool has_managed_zone(enum zone_type zone); > static inline bool has_managed_dma(void) > { > +#ifdef CONFIG_ZONE_DMA > + return has_managed_zone(ZONE_DMA); > +#else > return false; > -} > #endif > +} > > > #ifndef CONFIG_NUMA > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 822e05f1a964..36ccc85c5073 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7418,20 +7418,16 @@ bool put_page_back_buddy(struct page *page) > } > #endif > > -#ifdef CONFIG_ZONE_DMA > -bool has_managed_dma(void) > +bool has_managed_zone(enum zone_type zone) > { > struct pglist_data *pgdat; > > for_each_online_pgdat(pgdat) { > - struct zone *zone = &pgdat->node_zones[ZONE_DMA]; > - > - if (managed_zone(zone)) > + if (managed_zone(&pgdat->node_zones[zone])) > return true; > } > return false; > } > -#endif /* CONFIG_ZONE_DMA */ > > #ifdef CONFIG_UNACCEPTED_MEMORY > > -- > 2.34.1 > -- Sincerely yours, Mike.