public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Liam Howlett <liam.howlett@oracle•com>, Mike Rapoport <rppt@kernel•org>
Cc: Karolina Drobnik <karolinadrobnik@gmail•com>,
	Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Linux Next Mailing List <linux-next@vger•kernel.org>
Subject: linux-next: manual merge of the maple tree with the memblock tree
Date: Thu, 17 Feb 2022 17:22:13 +1100	[thread overview]
Message-ID: <20220217172213.355ca4f5@canb.auug.org.au> (raw)

[-- 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 --]

             reply	other threads:[~2022-02-17  6:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17  6:22 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-02-23  0:06 linux-next: manual merge of the maple tree with the memblock tree broonie
2022-02-17  6:16 Stephen Rothwell
2022-02-17  6:12 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220217172213.355ca4f5@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=karolinadrobnik@gmail$(echo .)com \
    --cc=liam.howlett@oracle$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=rppt@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox