linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the maple tree with the memblock tree
@ 2022-02-17  6:16 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2022-02-17  6:16 UTC (permalink / raw)
  To: Liam Howlett, Mike Rapoport
  Cc: Karolina Drobnik, Linux Kernel Mailing List,
	Linux Next Mailing List, Matthew Wilcox (Oracle)

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

Hi all,

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

  tools/testing/radix-tree/Makefile

between commit:

  5a198c3f9b0b ("tools: Move gfp.h and slab.h from radix-tree to lib")

from the memblock tree and commits:

  4af8015a7707 ("Maple Tree: Add new data structure")
  f6955b248f29 ("lib/test_maple_tree: Add testing for maple tree")

from the maple 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.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/radix-tree/Makefile
index c4ea4fbb0bfc,3e0fa6ae0e0a..000000000000
--- a/tools/testing/radix-tree/Makefile
+++ b/tools/testing/radix-tree/Makefile
@@@ -4,9 -4,8 +4,9 @@@ CFLAGS += -I. -I../../include -g -Og -W
  	  -fsanitize=undefined
  LDFLAGS += -fsanitize=address -fsanitize=undefined
  LDLIBS+= -lpthread -lurcu
- TARGETS = main idr-test multiorder xarray
+ TARGETS = main idr-test multiorder xarray maple
 -CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o maple.o
 +CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \
- 			 slab.o
++			 slab.o maple.o
  OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
  	 regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \
  	 iteration_check_2.o benchmark.o

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the maple tree with the memblock tree
@ 2022-02-23  0:06 broonie
  0 siblings, 0 replies; 4+ messages in thread
From: broonie @ 2022-02-23  0:06 UTC (permalink / raw)
  To: Liam Howlett
  Cc: Karolina Drobnik, Liam R . Howlett, Liam R . Howlett,
	Linux Kernel Mailing List, Linux Next Mailing List,
	Mike Rapoport

Hi all,

Today's linux-next merge of the maple tree got conflicts in:

  tools/testing/radix-tree/linux.c
  tools/testing/radix-tree/Makefile
  tools/include/linux/slab.h

between commit:

  aa0eab8639ff0 ("tools: Move gfp.h and slab.h from radix-tree to lib")

from the memblock tree and commits:

  3a77b4e41d4f3 ("radix tree test suite: Add support for slab bulk APIs")
  ad4144ea04112 ("lib/test_maple_tree: Add testing for maple tree")

from the maple 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 tools/include/linux/slab.h
index f41d8a0eb1a42,d7aed1cc69781..0000000000000
--- a/tools/include/linux/slab.h
+++ b/tools/include/linux/slab.h
@@@ -35,4 -24,8 +35,8 @@@ struct kmem_cache *kmem_cache_create(co
  			unsigned int align, unsigned int flags,
  			void (*ctor)(void *));
  
+ void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list);
+ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
+ 			  void **list);
+ 
 -#endif		/* SLAB_H */
 +#endif		/* _TOOLS_SLAB_H */
diff --cc tools/testing/radix-tree/Makefile
index c4ea4fbb0bfcd,3e0fa6ae0e0a3..0000000000000
--- a/tools/testing/radix-tree/Makefile
+++ b/tools/testing/radix-tree/Makefile
@@@ -4,9 -4,8 +4,9 @@@ CFLAGS += -I. -I../../include -g -Og -W
  	  -fsanitize=undefined
  LDFLAGS += -fsanitize=address -fsanitize=undefined
  LDLIBS+= -lpthread -lurcu
- TARGETS = main idr-test multiorder xarray
+ TARGETS = main idr-test multiorder xarray maple
 -CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o maple.o
 +CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \
- 			 slab.o
++			 slab.o maple.o
  OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
  	 regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \
  	 iteration_check_2.o benchmark.o
diff --cc tools/testing/radix-tree/linux.c
index 81539f5439546,3383d748c6509..0000000000000
--- a/tools/testing/radix-tree/linux.c
+++ b/tools/testing/radix-tree/linux.c
@@@ -77,6 -118,97 +117,71 @@@ void kmem_cache_free(struct kmem_cache 
  	pthread_mutex_unlock(&cachep->lock);
  }
  
+ void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list)
+ {
+ 	if (kmalloc_verbose)
+ 		pr_debug("Bulk free %p[0-%lu]\n", list, size - 1);
+ 
+ 	pthread_mutex_lock(&cachep->lock);
+ 	for (int i = 0; i < size; i++)
+ 		kmem_cache_free_locked(cachep, list[i]);
+ 	pthread_mutex_unlock(&cachep->lock);
+ }
+ 
+ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
+ 			  void **p)
+ {
+ 	size_t i;
+ 
+ 	if (kmalloc_verbose)
+ 		pr_debug("Bulk alloc %lu\n", size);
+ 
+ 	if (!(gfp & __GFP_DIRECT_RECLAIM)) {
+ 		if (cachep->non_kernel < size)
+ 			return 0;
+ 
+ 		cachep->non_kernel -= size;
+ 	}
+ 
+ 	pthread_mutex_lock(&cachep->lock);
+ 	if (cachep->nr_objs >= size) {
+ 		struct radix_tree_node *node;
+ 
+ 		for (i = 0; i < size; i++) {
+ 			node = cachep->objs;
+ 			cachep->nr_objs--;
+ 			cachep->objs = node->parent;
+ 			p[i] = node;
+ 			node->parent = NULL;
+ 		}
+ 		pthread_mutex_unlock(&cachep->lock);
+ 	} else {
+ 		pthread_mutex_unlock(&cachep->lock);
+ 		for (i = 0; i < size; i++) {
+ 			if (cachep->align) {
+ 				posix_memalign(&p[i], cachep->align,
+ 					       cachep->size * size);
+ 			} else {
+ 				p[i] = malloc(cachep->size * size);
+ 			}
+ 			if (cachep->ctor)
+ 				cachep->ctor(p[i]);
+ 			else if (gfp & __GFP_ZERO)
+ 				memset(p[i], 0, cachep->size);
+ 		}
+ 	}
+ 
+ 	for (i = 0; i < size; i++) {
+ 		uatomic_inc(&nr_allocated);
+ 		uatomic_inc(&cachep->nr_allocated);
+ 		uatomic_inc(&cachep->nr_tallocated);
+ 		if (kmalloc_verbose)
+ 			printf("Allocating %p from slab\n", p[i]);
+ 	}
+ 
+ 	return size;
+ }
+ 
 -void *kmalloc(size_t size, gfp_t gfp)
 -{
 -	void *ret;
 -
 -	if (!(gfp & __GFP_DIRECT_RECLAIM))
 -		return NULL;
 -
 -	ret = malloc(size);
 -	uatomic_inc(&nr_allocated);
 -	if (kmalloc_verbose)
 -		printf("Allocating %p from malloc\n", ret);
 -	if (gfp & __GFP_ZERO)
 -		memset(ret, 0, size);
 -	return ret;
 -}
 -
 -void kfree(void *p)
 -{
 -	if (!p)
 -		return;
 -	uatomic_dec(&nr_allocated);
 -	if (kmalloc_verbose)
 -		printf("Freeing %p to malloc\n", p);
 -	free(p);
 -}
 -
  struct kmem_cache *
  kmem_cache_create(const char *name, unsigned int size, unsigned int align,
  		unsigned int flags, void (*ctor)(void *))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the maple tree with the memblock tree
@ 2022-02-17  6:22 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2022-02-17  6:22 UTC (permalink / raw)
  To: Liam Howlett, Mike Rapoport
  Cc: Karolina Drobnik, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 3368 bytes --]

Hi all,

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

  tools/testing/radix-tree/linux.c

between commit:

  5a198c3f9b0b ("tools: Move gfp.h and slab.h from radix-tree to lib")

from the memblock tree and commit:

  3a77b4e41d4f ("radix tree test suite: Add support for slab bulk APIs")

from the maple 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.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/radix-tree/linux.c
index 81539f543954,3383d748c650..000000000000
--- a/tools/testing/radix-tree/linux.c
+++ b/tools/testing/radix-tree/linux.c
@@@ -77,6 -118,97 +117,71 @@@ void kmem_cache_free(struct kmem_cache 
  	pthread_mutex_unlock(&cachep->lock);
  }
  
+ void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list)
+ {
+ 	if (kmalloc_verbose)
+ 		pr_debug("Bulk free %p[0-%lu]\n", list, size - 1);
+ 
+ 	pthread_mutex_lock(&cachep->lock);
+ 	for (int i = 0; i < size; i++)
+ 		kmem_cache_free_locked(cachep, list[i]);
+ 	pthread_mutex_unlock(&cachep->lock);
+ }
+ 
+ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
+ 			  void **p)
+ {
+ 	size_t i;
+ 
+ 	if (kmalloc_verbose)
+ 		pr_debug("Bulk alloc %lu\n", size);
+ 
+ 	if (!(gfp & __GFP_DIRECT_RECLAIM)) {
+ 		if (cachep->non_kernel < size)
+ 			return 0;
+ 
+ 		cachep->non_kernel -= size;
+ 	}
+ 
+ 	pthread_mutex_lock(&cachep->lock);
+ 	if (cachep->nr_objs >= size) {
+ 		struct radix_tree_node *node;
+ 
+ 		for (i = 0; i < size; i++) {
+ 			node = cachep->objs;
+ 			cachep->nr_objs--;
+ 			cachep->objs = node->parent;
+ 			p[i] = node;
+ 			node->parent = NULL;
+ 		}
+ 		pthread_mutex_unlock(&cachep->lock);
+ 	} else {
+ 		pthread_mutex_unlock(&cachep->lock);
+ 		for (i = 0; i < size; i++) {
+ 			if (cachep->align) {
+ 				posix_memalign(&p[i], cachep->align,
+ 					       cachep->size * size);
+ 			} else {
+ 				p[i] = malloc(cachep->size * size);
+ 			}
+ 			if (cachep->ctor)
+ 				cachep->ctor(p[i]);
+ 			else if (gfp & __GFP_ZERO)
+ 				memset(p[i], 0, cachep->size);
+ 		}
+ 	}
+ 
+ 	for (i = 0; i < size; i++) {
+ 		uatomic_inc(&nr_allocated);
+ 		uatomic_inc(&cachep->nr_allocated);
+ 		uatomic_inc(&cachep->nr_tallocated);
+ 		if (kmalloc_verbose)
+ 			printf("Allocating %p from slab\n", p[i]);
+ 	}
+ 
+ 	return size;
+ }
+ 
 -void *kmalloc(size_t size, gfp_t gfp)
 -{
 -	void *ret;
 -
 -	if (!(gfp & __GFP_DIRECT_RECLAIM))
 -		return NULL;
 -
 -	ret = malloc(size);
 -	uatomic_inc(&nr_allocated);
 -	if (kmalloc_verbose)
 -		printf("Allocating %p from malloc\n", ret);
 -	if (gfp & __GFP_ZERO)
 -		memset(ret, 0, size);
 -	return ret;
 -}
 -
 -void kfree(void *p)
 -{
 -	if (!p)
 -		return;
 -	uatomic_dec(&nr_allocated);
 -	if (kmalloc_verbose)
 -		printf("Freeing %p to malloc\n", p);
 -	free(p);
 -}
 -
  struct kmem_cache *
  kmem_cache_create(const char *name, unsigned int size, unsigned int align,
  		unsigned int flags, void (*ctor)(void *))

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the maple tree with the memblock tree
@ 2022-02-17  6:12 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2022-02-17  6:12 UTC (permalink / raw)
  To: Liam Howlett, Mike Rapoport
  Cc: Karolina Drobnik, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]

Hi all,

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

  tools/include/linux/slab.h

between commit:

  5a198c3f9b0b ("tools: Move gfp.h and slab.h from radix-tree to lib")

from the memblock tree and commit:

  3a77b4e41d4f ("radix tree test suite: Add support for slab bulk APIs")

from the maple 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.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/include/linux/slab.h
index f41d8a0eb1a4,d7aed1cc6978..000000000000
--- a/tools/include/linux/slab.h
+++ b/tools/include/linux/slab.h
@@@ -35,4 -24,8 +35,8 @@@ struct kmem_cache *kmem_cache_create(co
  			unsigned int align, unsigned int flags,
  			void (*ctor)(void *));
  
+ void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list);
+ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
+ 			  void **list);
+ 
 -#endif		/* SLAB_H */
 +#endif		/* _TOOLS_SLAB_H */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-23  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17  6:16 linux-next: manual merge of the maple tree with the memblock tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2022-02-23  0:06 broonie
2022-02-17  6:22 Stephen Rothwell
2022-02-17  6:12 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).