summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-05-01 19:02:09 -0700
committerJakub Kicinski <kuba@kernel.org>2026-05-01 19:02:10 -0700
commit0f19519fdd22bc0f5429377da3a52327c5eee166 (patch)
tree944eb2ffb7b2b7077f9aa8fb5976f2adbebe0127 /include/linux
parentff393252f99f261ba885f05fbfdfe89807c7ffd3 (diff)
parentfbf6f64a4322cfeb0d98f39baf8ce18246dd12c0 (diff)
Merge branch 'net-mlx5-enable-sub-page-allocations-for-mlx5_frag_buf'
Tariq Toukan says: ==================== net/mlx5: enable sub-page allocations for mlx5_frag_buf This series aims to improve memory utilization for DMA-coherent fragmented-buffer allocations on systems with large PAGE_SIZE. Before this change, such allocations were page-granular, as they were backed by full pages. On large-page systems this caused significant internal waste for small objects. For example, a single 4K request consumed an entire 64K page. The common kernel solution for sub-page coherent DMA allocations is the DMA pool API. However, those pools do not return pages to the system until teardown. That behavior is not a good fit for mlx5_frag_buf allocations, since they back interface resources (WQs and CQs). Interfaces may be removed dynamically, so their memory footprint should reflect live usage to avoid situations where large amounts of memory remain tied up in pools. This series introduces a lightweight mlx5-local pool implementation for sub-page coherent DMA allocations, which immediately returns free backing pages. It wires mlx5_frag_buf allocations to use these internal pools, while keeping the mechanism reusable for other mlx5-internal coherent DMA allocation users in follow-up work. ==================== Link: https://patch.msgid.link/20260429201429.223809-1-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mlx5/driver.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 04b96c5abb57..531ce66fc8ef 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -343,9 +343,11 @@ struct mlx5_cmd_mailbox {
struct mlx5_cmd_mailbox *next;
};
+struct mlx5_dma_pool_page;
struct mlx5_buf_list {
void *buf;
dma_addr_t map;
+ struct mlx5_dma_pool_page *frag_page;
};
struct mlx5_frag_buf {
@@ -558,6 +560,7 @@ enum mlx5_func_type {
MLX5_FUNC_TYPE_NUM,
};
+struct mlx5_frag_buf_node_pools;
struct mlx5_ft_pool;
struct mlx5_priv {
/* IRQ table valid only for real pci devices PF or VF */
@@ -581,14 +584,16 @@ struct mlx5_priv {
struct mlx5_debugfs_entries dbg;
- /* start: alloc staff */
+ /* start: alloc stuff */
/* protect buffer allocation according to numa node */
struct mutex alloc_mutex;
int numa_node;
struct mutex pgdir_mutex;
struct list_head pgdir_list;
- /* end: alloc staff */
+
+ struct mlx5_frag_buf_node_pools **frag_buf_node_pools;
+ /* end: alloc stuff */
struct mlx5_adev **adev;
int adev_idx;