lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220217172213.355ca4f5@canb.auug.org.au>
Date:   Thu, 17 Feb 2022 17:22:13 +1100
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     Liam Howlett <liam.howlett@...cle.com>,
        Mike Rapoport <rppt@...nel.org>
Cc:     Karolina Drobnik <karolinadrobnik@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: linux-next: manual merge of the maple tree with the memblock tree

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 *))

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ