From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61567C433EF for ; Thu, 27 Jan 2022 13:36:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C6C26B0073; Thu, 27 Jan 2022 08:36:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B1D76B0075; Thu, 27 Jan 2022 08:36:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 303E56B00A0; Thu, 27 Jan 2022 08:36:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 169E16B0073 for ; Thu, 27 Jan 2022 08:36:51 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CE95F181CB2C3 for ; Thu, 27 Jan 2022 13:36:50 +0000 (UTC) X-FDA: 79076167380.04.19A3F28 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id A9551140006 for ; Thu, 27 Jan 2022 13:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=t8uKPMm+WT9eNttOsz40v+9fY5TpP+ldKER0j08mQ5k=; b=P7dJz4qf2KlOhCsIxTJaRDVb3q AJN3yaOtHXfwE0zKeOD27j5ikUu4zdbrWit27WGyOhYk82giJzMUUFIimKEuLam+jo7nIx5qAGmsf 9cml1xNfXJ1jw/3w11APXrHyKigNVqD8+o34S9Y0EJNeEsPlxqAp7fW/LZRi8zAm8orDEHouzIL1A UXAA7XjgmPld61YnqJ0gJBPPFthLixBB/JxsUr7ingkmMoKCNJqrIG12rbfNhZBCFd4W70lEfPzRJ k9SnHKZRs1086kJoxr3eO+s3H4f2OiHQZK0ZuI+SAeyIskETAnGobAm6+F6iobRaF63U06PyMWfht WOweGG+w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nD4xD-005H7t-Ez; Thu, 27 Jan 2022 13:36:47 +0000 Date: Thu, 27 Jan 2022 13:36:47 +0000 From: Matthew Wilcox To: Karolina Drobnik Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/16] tools: Move gfp.h and slab.h from radix-tree to lib Message-ID: References: <777d0cfcf531357cfe39d53987aa964a3a42ce8b.1643206612.git.karolinadrobnik@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <777d0cfcf531357cfe39d53987aa964a3a42ce8b.1643206612.git.karolinadrobnik@gmail.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A9551140006 X-Rspam-User: nil Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=P7dJz4qf; dmarc=none; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: 3hbdrmybt3skk6rt81t1bc9ieb9qx944 X-HE-Tag: 1643290609-763984 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jan 27, 2022 at 02:21:19PM +0100, Karolina Drobnik wrote: > diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c > index 2d9c59df60de..81539f543954 100644 > --- a/tools/testing/radix-tree/linux.c > +++ b/tools/testing/radix-tree/linux.c > @@ -14,7 +14,6 @@ > > int nr_allocated; > int preempt_count; > -int kmalloc_verbose; > int test_verbose; > > struct kmem_cache { > @@ -78,32 +77,6 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp) > pthread_mutex_unlock(&cachep->lock); > } > > -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 *)) I don't think it makes much sense to move kmalloc() and not to move the kmem_cache* functions. They're all provided by slab in the kernel proper, so while you don't use them, I think keeping all the memory allocation functions together is preferable.