All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Björn Töpel" <bjorn@kernel.org>
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
Subject: Re: [RFC 07/11] eth: ixgbe: use dma_alloc_coherent_node()
Date: Tue, 27 Oct 2026 11:20:03 -0700	[thread overview]
Message-ID: <20261027112003.330bbded@kernel.org> (raw)
In-Reply-To: <87wlr33z6z.fsf@all.your.base.are.belong.to.us>

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()".

WDYT?

  reply	other threads:[~2026-10-27 18:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27  2:25 [RFC 00/11] dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node() Jakub Kicinski
2026-10-27  2:25 ` [RFC 01/11] dma-contiguous: pass the NUMA node to dma_alloc_contiguous() Jakub Kicinski
2026-10-27  2:25 ` [RFC 02/11] dma-direct: pass the NUMA node to dma_direct_alloc() Jakub Kicinski
2026-10-27  2:25 ` [RFC 03/11] iommu/dma: pass the NUMA node to iommu_dma_alloc() Jakub Kicinski
2026-10-27  2:25 ` [RFC 04/11] dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node() Jakub Kicinski
2026-10-27  9:03   ` Björn Töpel
2026-10-27 15:53     ` Jakub Kicinski
2026-10-27 15:24   ` Marek Szyprowski
2026-10-27 17:52     ` Jakub Kicinski
2026-10-28  9:00       ` Marek Szyprowski
2026-10-27  2:25 ` [RFC 05/11] eth: libwx: restore the device's NUMA node after ring allocation Jakub Kicinski
2026-10-27  2:25 ` [RFC 06/11] eth: libwx: use dma_alloc_coherent_node() Jakub Kicinski
2026-10-27  2:25 ` [RFC 07/11] eth: ixgbe: " Jakub Kicinski
2026-10-27  9:06   ` Björn Töpel
2026-10-27 15:51     ` Jakub Kicinski
2026-10-27 16:06       ` Björn Töpel
2026-10-27 18:20         ` Jakub Kicinski [this message]
2026-10-29  8:47           ` Björn Töpel
2026-10-29  9:17             ` Marek Szyprowski
2026-10-27  2:25 ` [RFC 08/11] eth: xgbe: " Jakub Kicinski
2026-10-27  2:25 ` [RFC 09/11] eth: fungible: " Jakub Kicinski
2026-10-27  2:25 ` [RFC 10/11] eth: mlx5: " Jakub Kicinski
2026-10-27  2:25 ` [RFC 11/11] eth: mlx4: " Jakub Kicinski
2026-10-27  9:03 ` [RFC 00/11] dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node() Björn Töpel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261027112003.330bbded@kernel.org \
    --to=kuba@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=leon@kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.