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 36B9AC433F5 for ; Fri, 28 Jan 2022 11:02:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B16FA6B0072; Fri, 28 Jan 2022 06:02:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC5A76B0073; Fri, 28 Jan 2022 06:02:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98DBA6B0074; Fri, 28 Jan 2022 06:02:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 8A2B86B0072 for ; Fri, 28 Jan 2022 06:02:18 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4751A181CC1C9 for ; Fri, 28 Jan 2022 11:02:18 +0000 (UTC) X-FDA: 79079406756.10.A353C08 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf20.hostedemail.com (Postfix) with ESMTP id 35A071C0023 for ; Fri, 28 Jan 2022 11:02:16 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id a28so10977633lfl.7 for ; Fri, 28 Jan 2022 03:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=Fyd0Ziaw1nr9AJZhmIrLx7uDIDl3wwWJvaUZ/WDOfAY=; b=GSwTgVNkQwIXutDy4LJ+Pwz+w3RjKAOT8ZkOgm7LDkta98Gg0Y1EjmIZARNDa6YaB5 jE1qDp61AAfJ4diwimfVnVXtP4/aEpzlAi8saI2jQhcM9UnTPMJJIN9WGlIJjLluGHwk g0MxLlZ+0gOhWroxDbTarCXUNrklE9bPKvdg3caq4sAaJ3ZBU4nqji0sArNBw0zpNR3x wmWj2NeRVdSC27djFl3Sb6wxVZjpHRwqMX4Q+DrQDuWqUbNLX2MgTLJcwhh7ELYDCN3m 0SNGDAXN1/ck1b+92HmmHolroauyLmzxUIf7uEg09gkbrZ+9N9brweLGNDKKNH0HQLb2 KJzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=Fyd0Ziaw1nr9AJZhmIrLx7uDIDl3wwWJvaUZ/WDOfAY=; b=MKMbyDM+x6XjWHlZsULOklUQdKk0mJ9EPYPY9l2AW2oTwnO+gV99YSq8gwsvZo0Xme mds+9hWor5fFX87LwKdqOug6/A9QYGG3aUtSJ2TsSh+aoAkkKRf2aNPT6Z2KH7UWq2hC OzRQqdqsRbgKkY+dDWXkylzpNfu9BPvra3K/H35xm0MlWo7CbGq78x4o5PeeT6j/h07i l5N8LGd2LI+xnmsjX9lQYo/OT7DvUbESpE5/BxaDmKYfIZztOnduHKuDRtAS4K+V6fu/ U+ZcAlci/nvz4P+dRVJUNUnuy8TWwFyW46Vb7505QclkPjZZuktVfnQkI7qLumpo92LB PkxA== X-Gm-Message-State: AOAM533/FjNr1u46nolVrF7ohEydqyhRhxidu25U/VZzC+ikdgSYqPiL DCqkoRVurNoCocwIUoRgd0s= X-Google-Smtp-Source: ABdhPJwcbSofihC8mwwpTjjmMQDl55yQOMDYd/zmv1r8lmOwtwaC0Sqt1ujnP6YGEpl+Sb9sRAD9zQ== X-Received: by 2002:a05:6512:3e2a:: with SMTP id i42mr5693806lfv.636.1643367735532; Fri, 28 Jan 2022 03:02:15 -0800 (PST) Received: from [192.168.50.104] (staticline-31-183-164-222.toya.net.pl. [31.183.164.222]) by smtp.gmail.com with ESMTPSA id p34sm2490471lfa.309.2022.01.28.03.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 03:02:14 -0800 (PST) Message-ID: <4eee8241e35fac1fa05eee3525a10672396c18ec.camel@gmail.com> Subject: Re: [PATCH 01/16] tools: Move gfp.h and slab.h from radix-tree to lib From: Karolina Drobnik To: Matthew Wilcox Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mike.rapoport@gmail.com, linux-kernel@vger.kernel.org Date: Fri, 28 Jan 2022 12:02:13 +0100 In-Reply-To: References: <777d0cfcf531357cfe39d53987aa964a3a42ce8b.1643206612.git.karolinadrobnik@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 35A071C0023 X-Stat-Signature: d34wt83bzmra6o7z8jrxoajtgfoqqwhy Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GSwTgVNk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of karolinadrobnik@gmail.com designates 209.85.167.51 as permitted sender) smtp.mailfrom=karolinadrobnik@gmail.com X-Rspam-User: nil X-HE-Tag: 1643367736-797045 Content-Transfer-Encoding: quoted-printable 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, 2022-01-27 at 13:36 +0000, Matthew Wilcox wrote: > 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 @@ > > =C2=A0 > > =C2=A0int nr_allocated; > > =C2=A0int preempt_count; > > -int kmalloc_verbose; > > =C2=A0int test_verbose; > > =C2=A0 > > =C2=A0struct kmem_cache { > > @@ -78,32 +77,6 @@ void kmem_cache_free(struct kmem_cache *cachep, > > void *objp) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0pthread_mutex_unlock(= &cachep->lock); > > =C2=A0} > > =C2=A0 > > -void *kmalloc(size_t size, gfp_t gfp) > > -{ > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0void *ret; > > - > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!(gfp & __GFP_DIRECT_R= ECLAIM)) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0return NULL; > > - > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0ret =3D malloc(size); > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0uatomic_inc(&nr_allocated)= ; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (kmalloc_verbose) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0printf("Allocating %p from malloc\n", ret); > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (gfp & __GFP_ZERO) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0memset(ret, 0, size); > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return ret; > > -} > > - > > -void kfree(void *p) > > -{ > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!p) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0return; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0uatomic_dec(&nr_allocated)= ; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (kmalloc_verbose) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0printf("Freeing %p to malloc\n", p); > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0free(p); > > -} > > - > > =C2=A0struct kmem_cache * > > =C2=A0kmem_cache_create(const char *name, unsigned int size, unsigned > > int align, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0unsigned int flags, void (*ctor)(void *)) >=20 > I don't think it makes much sense to move kmalloc() and not to move > the kmem_cache* functions.=C2=A0 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. I wasn't sure if these functions would be used by other test suites, so I left them here. But I can move them if you think it's better to keep them together.