Optimize DMABUF mkey page size in mlx5
authorLeon Romanovsky <leon@kernel.org>
Sun, 13 Jul 2025 07:00:21 +0000 (03:00 -0400)
committerLeon Romanovsky <leon@kernel.org>
Sun, 13 Jul 2025 07:00:21 +0000 (03:00 -0400)
commit9879bddf5ab47ad3d889d31ca7550605a4207dba
tree87a6a7d65a942121e24dc902eaee598dd192f186
parent98269398c02ab20eb9ed6d77416023a2627049d8
parentc4f96972c3c206ac8f6770b5ecd5320b561d0058
Optimize DMABUF mkey page size in mlx5

From Edward:

This patch series enables the mlx5 driver to dynamically choose the
optimal page size for a DMABUF-based memory key (mkey), rather than
always registering with a fixed page size.

Previously, DMABUF memory registration used a fixed 4K page size for
mkeys which could lead to suboptimal performance when the underlying
memory layout may offer better page sizes.

This approach did not take advantage of larger page size capabilities
advertised by the HCA, and the driver was not setting the proper page
size mask in the mkey mask when performing page size changes,
potentially
leading to invalid registrations when updating to a very large pages.

This series improves DMABUF performance by dynamically selecting the
best page size for a given memory region (MR) both at creation time and
on page fault occurrences, based on the underlying layout and fixing
related gaps and bugs.

By doing so, we reduce the number of page table entries (and thus MTT/
KSM descriptors) that the HCA must traverse, which in turn reduces
cache-line fetches.

Thanks

* mlx5-next:
  RDMA/mlx5: Fix UMR modifying of mkey page size
  net/mlx5: Expose HCA capability bits for mkey max page size

Signed-off-by: Leon Romanovsky <leon@kernel.org>