🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8493

Re: [RFC 07/11] eth: ixgbe: use dma_alloc_coherent_node()

#8493
From: Björn Töpel
Date: Thu, 29 Oct 2026 08:47
66 lines
10336 bytes
Jakub Kicinski <kuba@kernel.org> writes:

> On Tue, 27 Oct 2026 17:06:44 +0100 Björn Töpel wrote:
>> Jakub Kicinski <kuba@kernel.org> writes:
>> > On Tue, 27 Oct 2026 10:06:03 +0100 Björn Töpel wrote:  
>> >> Not really this series, but the fallback here is odd, no? I thought the
>> >> allocator already did cross-zone fallback?  
>> >
>> > Fair, I was too lazy to check. I'll remove the fallbacks in the same
>> > patch. Seems obvious enough. LMK if you prefer separate.  
>> 
>> Hmm. Seems like dma_alloc_contiguous() doesn't spill over to other
>> nodes. It only tries the per-NUMA CMA... so keeping it is bit more
>> robust. (Then again, I dunno...)
>> 
>> I'd say keep it.
>
> Or we fold the retry into the helper? I tried to write the kdoc:
>
> /**
>  * dma_alloc_attrs_node - allocate coherent memory on a given NUMA node
>  * @dev: device to allocate the memory for
>  * @size: size of the allocation
>  * @dma_handle: returns the DMA address of the allocation
>  * @flag: GFP flags for the allocation
>  * @attrs: DMA_ATTR_* flags for the allocation
>  * @node: NUMA node to allocate the memory on, NUMA_NO_NODE for no preference
>  *
>  * Same as dma_alloc_attrs() but places the memory on @node rather than on the
>  * node of @dev. Like with kmalloc_node() the node is only a preference,
>  * the page allocator may fall back to other nodes if @node is out of memory.
>  * The contiguous memory allocator (CMA) does not: only the CMA area of @node
>  * and the global CMA area are tried. The allocation may fail even though the
>  * CMA area of another node, e.g. that of @dev, still has free space.
>  *
>  * Allocations served from per-device coherent pools or CMA areas, restricted
>  * or atomic pools, or by dma_map_ops implementations do not take @node into
>  * account.
>  *
>  * Return: the CPU address of the allocation, or NULL on failure.
>  */
>
> This feels like too much explaining of the internals for a commonly
> used APIs. If we retry in the helper all we have to say is basically
> "acts like kmalloc_node()".

Yeah, that's a lot.

> WDYT?

Agree that it's odd that the caller need to know CMA internals, but I'm
not sure retrying the entire DMA allocation in the helper is the right
way. Can the fallback be handled in dma_alloc_contigous()? I would still
not do that in this series, but keep as is.


Björn
Technical Details
Message-ID: <87se1o51wu.fsf@all.your.base.are.belong.to.us>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353210-linux-kernel-netdev=dewy.ru
References: <20261027022528.633359-1-kuba@kernel.org> <20261027022528.633359-8-kuba@kernel.org> <87ecdb5x8k.fsf@all.your.base.are.belong.to.us> <20261027085133.2832f2f5@kernel.org> <87wlr33z6z.fsf@all.your.base.are.belong.to.us> <20261027112003.330bbded@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353210-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: Re: [RFC 07/11] eth: ixgbe: use dma_alloc_coherent_node()
Date: Thu, 29 Oct 2026 09:47:13 +0100
Organization: Usenet Network
Message-ID: <87se1o51wu.fsf@all.your.base.are.belong.to.us>
References: <20261027022528.633359-1-kuba@kernel.org>
 <20261027022528.633359-8-kuba@kernel.org>
 <87ecdb5x8k.fsf@all.your.base.are.belong.to.us>
 <20261027085133.2832f2f5@kernel.org>
 <87wlr33z6z.fsf@all.your.base.are.belong.to.us>
 <20261027112003.330bbded@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1968658"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:LdKzm3t2bk9r9+YsJMHR+BZwsi0= sha256:S2NAUBHWi4bDbSTMkQYv1pJxbKU6u8qU0jg0fCzZ0cM=
	sha1:f3i/O4uOjxfqM+MrlpjCTxl5Gtg= sha256:C4VmDNwV1V1U9ozS8Nn8NNuek+WurmywySszNEKsT9Q=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id CC751125C5C; Thu, 29 Oct 2026 11:51:06 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 8iExhqPhZXcy;
	Thu, 29 Oct 2026 11:51:04 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353210-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 071D0125C5D; Thu, 29 Oct 2026 11:50:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7CE5C28022; Thu, 29 Oct 2026 08:47:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793263638;
	b=EdXs3p7wrSv+JgF/ygS3vs9DYPnqb5uhBQ1y4b4JVhCZJX7Sg0K7r+u2vS9hEpJSbrvb
	 QG4ej8FUOW2LPY2LRBqACVAyxXH0Ppz6E9dr2R41FYU4LDQxOTAvybfDIHEhpFZAVGpgc
	 wQt1ztETJ6QHx+dPwD5PuhXgRwlQV4KRmKetjKQOxk8Ve4MYsDY2n27wV9S9sY+Q/Ipjs
	 xp58UtNhFP0Lvb31yyVNyVVQcbUDGoZoTcHrUy1YGE27M/21NrKwjahq4+W71nRLiPB0Y
	 5wO+3JyqEv3O3b503ZTuXy7NnDHcdC04p07uiohV0QhE5f9oe+tpN9yu5+yyE7ro45A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793263638;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=4tWzvPGDH9mvPXm1tzajzmTu6lw50GNdOEOJxyUN2/w=;
	b=mA3SCCs4B7YnCUVWfR+EDVcg7Y9bjE2wz1vyX87YB3f2SO4iXb8vAYTJ5nyUXL/72+ed
	 g3rdyt8sxjD/xLcHVHf/XMmrDzx3CFzWLodXHHl0ZRHkcKn35XMd5W/H5ESbtqQVEawsm
	 Uvmm3c9mluX6V/N570U1ujD5q7sQh17KNKDL4qcFDLrJiXbKvxDs9OzYWPLy0btbz8DsC
	 ZVex4uwwwmzHOaX2nB3jc2JulN71F5Hyn6rKq+TpssNViMXKnvYIZ8La8w5lc038pzupu
	 yVy6LZVlHHwW8Q4YOiiauaKuA6tXz2Di/DhBVcoWlic+ZPuFRD8Prkhaw/iX4PBnQlA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SM7NOAOb;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 544B7606A324;
	Thu, 29 Oct 2026 08:47:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SM7NOAOb
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793263637;
	b=4CothBMQGL0H1wiFT37F133QUAIiF9vkx/x6nHnqL0644JVTGdOhWXHJAQT0oHYxKOIL
	 5bhK4DE6LHnN22M/NkzzyZ9MEFcjzmTDkmcUt2WW/7Of56brr00D5l4tRP3C7mPCDL/sj
	 aSmUDBPV47R4yqLC1KpctpfD+r/wFr9NnYhmVXaYW0PxHsGeY7ugmF0PVepIyaVy4NB1t
	 IjnFp8N/rqGf1Lmr5YTOCL8RJCCwqN/usOkyJzNFDQJ70qJw0VPS/tOqCRGk344HZtjTp
	 UjYPz8gRCgEx9j34AMaQ1Zau6BrNSzL3Wqq2o1WLlO27gIqqLk1AA9qLaGONTQIOyQg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793263637;
	h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References:
	 Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=4tWzvPGDH9mvPXm1tzajzmTu6lw50GNdOEOJxyUN2/w=;
	b=V7eQbUNZ/d6ViM5nUnTXA5Ts6LT34O6vtcf5rdOlwW+wQ20Kd/lFF8X0gdJEkgt1pv7x
	 TYvJifga09eZKrHYXzZoQYS6UQBvcYYN3ZpWYJtz1P1yWYcJGGDUxCa+Z/QM8Aj2UI4Hg
	 E8+ZsjfpV+dNxZ1A5KGWN9X+eZ4Cy9IDK1pqNVPDW0w0sCN3cR9wfR8QABguDB7zdVIHd
	 NeUhDotlaC7s1vWYMs+zfeD43OaFzPgcbV1HucmCkR5ZKcQx0yfMv+0gN93pZtR/qSKF6
	 Wanmo42kNpdY3xQi5UKS63k/J3GTqsAjYh9sd1k5OHbXnK850mzMvivqhO3B4NT8UIg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SM7NOAOb;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C8F8606A31D;
	Thu, 29 Oct 2026 08:47:16 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 421F01F01825;
	Thu, 29 Oct 2026 08:47:16 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793263636;
	bh=4tWzvPGDH9mvPXm1tzajzmTu6lw50GNdOEOJxyUN2/w=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=SM7NOAObV6yLm194Hre7ixIO0+FSyhfzVLoIro9v7Rs8xnvUm2SckEhJ4DY8bTToB
	 2FB9eGzlbxHfXkKyD4Q/1AwRFitcDwjhrnlXQ3KShQd1GrQYfMMNsErBangdFf38I9
	 ZXtru0fiN/5TQGOSyIRqpkag8vBTMsvvvWVfNAGtzXv5Z0jxwyz0px4UXAiRLlBRP5
	 GQVye6xLM+FpaMegTkUOMLqHBCPSrGLuxcFWag7XtvRTePeBscMLxM5+uTM2BHjyqT
	 gH3vcHwZz5a081iBSXYlOR/QAGUrOGdoLczribwEYBf6U2C7TtE6X4fIy+qzil1yi3
	 0djNSXaqBWm7A==
X-Cc: robin.murphy@arm.com, m.szyprowski@samsung.com, tglx@kernel.org,
 dave.hansen@linux.intel.com, x86@kernel.org, joro@8bytes.org,
 will@kernel.org, leon@kernel.org, mbloch@nvidia.com,
 iommu@lists.linux.dev, netdev@vger.kernel.org
X-In-Reply-To: <20261027112003.330bbded@kernel.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list