linux-next: manual merge of the slab tree with the drm-misc tree
From: Mark Brown
Date: Fri May 29 2026 - 18:59:12 EST
Hi all,
Today's linux-next merge of the slab tree got a conflict in:
drivers/gpu/drm/panthor/panthor_mmu.c
between commit:
1013bf53650ec ("drm/panthor: Split panthor_vm_prepare_map_op_ctx() to prepare for reclaim")
from the drm-misc tree and commit:
90720e61fb737 ("mm/slab: improve kmem_cache_alloc_bulk")
from the slab tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --cc drivers/gpu/drm/panthor/panthor_mmu.c
index 9d45008505619,b12c641af46c8..0000000000000
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@@ -1235,44 -1180,6 +1235,45 @@@ panthor_vm_op_ctx_prealloc_vmas(struct
return 0;
}
+static void panthor_vm_init_op_ctx(struct panthor_vm_op_ctx *op_ctx,
+ u64 size, u64 va, u32 flags)
+{
+ memset(op_ctx, 0, sizeof(*op_ctx));
+ op_ctx->flags = flags;
+ op_ctx->va.range = size;
+ op_ctx->va.addr = va;
+}
+
+static int panthor_vm_op_ctx_prealloc_pts(struct panthor_vm_op_ctx *op_ctx)
+{
+ u64 size = op_ctx->va.range;
+ u64 va = op_ctx->va.addr;
- int ret;
+
+ /* L1, L2 and L3 page tables.
+ * We could optimize L3 allocation by iterating over the sgt and merging
+ * 2M contiguous blocks, but it's simpler to over-provision and return
+ * the pages if they're not used.
+ */
+ u64 pt_count = ((ALIGN(va + size, 1ull << 39) - ALIGN_DOWN(va, 1ull << 39)) >> 39) +
+ ((ALIGN(va + size, 1ull << 30) - ALIGN_DOWN(va, 1ull << 30)) >> 30) +
+ ((ALIGN(va + size, 1ull << 21) - ALIGN_DOWN(va, 1ull << 21)) >> 21);
+
+ op_ctx->rsvd_page_tables.pages = kzalloc_objs(*op_ctx->rsvd_page_tables.pages,
+ pt_count);
+ if (!op_ctx->rsvd_page_tables.pages)
+ return -ENOMEM;
+
- ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
- op_ctx->rsvd_page_tables.pages);
- op_ctx->rsvd_page_tables.count = ret;
- if (ret != pt_count)
++ if (!kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, pt_count,
++ op_ctx->rsvd_page_tables.pages)) {
++ op_ctx->rsvd_page_tables.count = 0;
+ return -ENOMEM;
++ }
++ op_ctx->rsvd_page_tables.count = pt_count;
+
+ return 0;
+}
+
#define PANTHOR_VM_BIND_OP_MAP_FLAGS \
(DRM_PANTHOR_VM_BIND_OP_MAP_READONLY | \
DRM_PANTHOR_VM_BIND_OP_MAP_NOEXEC | \
Attachment:
signature.asc
Description: PGP signature