linux-next: manual merge of the slab tree with the mm tree

From: Stephen Rothwell
Date: Mon Jun 19 2023 - 00:03:41 EST


Hi all,

Today's linux-next merge of the slab tree got a conflict in:

mm/slab_common.c

between commits:

fef594ee7142 ("mm/slab: simplify create_kmalloc_cache() args and make it static")
6e6f174b6eda ("mm/slab: limit kmalloc() minimum alignment to dma_get_cache_alignment()")

from the mm tree and commit:

d5bf48574699 ("mm/slab_common: use SLAB_NO_MERGE instead of negative refcount")

from the slab tree.

I fixed it up (I think - 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.

--
Cheers,
Stephen Rothwell

diff --cc mm/slab_common.c
index 43c008165f56,90ecaface410..000000000000
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@@ -892,24 -876,17 +890,24 @@@ new_kmalloc_cache(int idx, enum kmalloc
flags |= SLAB_CACHE_DMA;
}

+ if (minalign > ARCH_KMALLOC_MINALIGN) {
+ aligned_size = ALIGN(aligned_size, minalign);
+ aligned_idx = __kmalloc_index(aligned_size, false);
+ }
+
+ /*
+ * If CONFIG_MEMCG_KMEM is enabled, disable cache merging for
+ * KMALLOC_NORMAL caches.
+ */
+ if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_NORMAL))
+ flags |= SLAB_NO_MERGE;
+
- kmalloc_caches[type][idx] = create_kmalloc_cache(
- kmalloc_info[idx].name[type],
- kmalloc_info[idx].size, flags, 0,
- kmalloc_info[idx].size);
+ if (!kmalloc_caches[type][aligned_idx])
+ kmalloc_caches[type][aligned_idx] = create_kmalloc_cache(
+ kmalloc_info[aligned_idx].name[type],
+ aligned_size, flags);
+ if (idx != aligned_idx)
+ kmalloc_caches[type][idx] = kmalloc_caches[type][aligned_idx];
-
- /*
- * If CONFIG_MEMCG_KMEM is enabled, disable cache merging for
- * KMALLOC_NORMAL caches.
- */
- if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_NORMAL))
- kmalloc_caches[type][idx]->refcount = -1;
}

/*

Attachment: pgp6hkP5UXLi0.pgp
Description: OpenPGP digital signature