Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4358530imw; Tue, 12 Jul 2022 06:42:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vbo2kF2RCl7lwdAGkupglROMws4fL1WduGFz72txGUexhNJaBj0OzrUeficUE7mchxj96o X-Received: by 2002:a17:907:75ce:b0:72b:305f:5985 with SMTP id jl14-20020a17090775ce00b0072b305f5985mr20767184ejc.527.1657633327768; Tue, 12 Jul 2022 06:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657633327; cv=none; d=google.com; s=arc-20160816; b=jB5XevXb/eklrY6/Stw/z0jI40tuJGf4aAqZHhWUj8MLiguOhfoNjGovy5pZ31h51y vk4hqJynKNcIGoyxwudth7YGa7DV0gzlkhcp9OvGfwM/AnM/3h3uutybLIj8zNxN3F3W pNqADzYBneOdlw+c2+YsUDi9llAQqR3hyR40Bl4J2qpu5pNWWkY27Jb315xnbVGZqMdv R0RKGnwHigV+8pl50DWWB32h0HkGjx03V5PmKh0mkV8exXzEhepmb9cr3BjkID2D3AdS 4ADHCCHS6gZPIH1u+iYQEIqirkgeQS1IsC286iO/EAbp8jarLnNJCQL8brZUyaAOzJ+e 3Uqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W+t2TYQyUd3MLoRrZFHRafgKosCtEfHks/X4I7bodFI=; b=BXlH4MBqSEqI0lGe2iZcTp3CaIggykqOnaZGiHwgbJPQt0eVyPkv3Bq865m2FdNLJK 8sUcUZJ4O1f87Q4PXq09eDrJa8gsZOvMUVTERt53qgZAQ8RrBS8nSn1S4unldcJYgRSQ 0qXl7Gq34/5C1t2Sttj47R2vRar3A0LmobMT8i1TzD7CmutgeO6BRgUUqPRVroWiY/sl JEnv8ml/wpk1/sfGtqqr+qk9ADgMjfmQ8hGjHBFHF3NwoMEXnrQURqi4aRYjtISVSXcJ UP96yDUUw6PJCoklNCrsXCr7fe82XaJhn2zb1f8DBx5BmqLvJd5jjSGUZM+iihBSeaf6 TaFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lC9cVXM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc8-20020a1709071c0800b0072b83c2b374si1912198ejc.62.2022.07.12.06.41.41; Tue, 12 Jul 2022 06:42:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lC9cVXM2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbiGLNkZ (ORCPT + 99 others); Tue, 12 Jul 2022 09:40:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233224AbiGLNkL (ORCPT ); Tue, 12 Jul 2022 09:40:11 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23EBFB7D65 for ; Tue, 12 Jul 2022 06:40:07 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id 89-20020a17090a09e200b001ef7638e536so11428262pjo.3 for ; Tue, 12 Jul 2022 06:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W+t2TYQyUd3MLoRrZFHRafgKosCtEfHks/X4I7bodFI=; b=lC9cVXM2npScD2ZYw8CT4kj9R7jq2JvDLs1QphPos+o7fmVpE0703VFXwBBoaSuZhj do6IQnZW/TV5vv8kqxIIgodC+sQz51op1rKKgohqWHwuj/MqEorzrMTj1co42+Ld/j0A CkDaf/7TID8mjapFQN4v6YVew41uT2Qd2o/kEPHo4zGlAW23FoGiiqYbRHKFBF7po/7L dsZEsN55SNfbFLL8fiY6CjOtiLvKP3rmoxVQhYK4YjZG59ppQ3+RlG0SrqRNd0hNO2s1 ilfwlaRg0ZSeaTuaEFpKYY1OvIh2/w7uQVwN3N3iXaEbVGBCCx9YE4c1oTG3TaIq8NmH l9ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W+t2TYQyUd3MLoRrZFHRafgKosCtEfHks/X4I7bodFI=; b=FORgWDRvaMe5IslZeePneLZ7TNkawMVr09Va+DRej3bkwMsMZoXAD3jUlWe+ToPzw1 uG3WE26ITS9nzlcH5Q8d8KbcET7fFGGxzWyhGiucy4UtIrTu7u+sESBJE9+eEJoN04Sh M0/eSj6hRi430EFCgBZBXRKn0uqv2xxSICzITnO6OsGixqrG5sE3K+Dd8xg3+QWykrFV LcjopCLqSJf7kz8jchlmSB0CiiPveeyRMdbtVi5K87z6yiM9QZHKoMx2Rkxwiv/JI7hE VGI8L/yhJ1B7a1hUOpfsUXZ2IcgFnbsWbey8raYTZ3VY7G/24pngt41qfOPjp6zyvMHl rFWg== X-Gm-Message-State: AJIora9Rb4UC5KDJRrQupM4YqY83QKnEZi5KJTfaK3d0x3bz/X8x19LS P1SKL/R40tj3rEjo5QchrGs= X-Received: by 2002:a17:90b:1c0e:b0:1ef:f82c:1746 with SMTP id oc14-20020a17090b1c0e00b001eff82c1746mr4371155pjb.124.1657633206339; Tue, 12 Jul 2022 06:40:06 -0700 (PDT) Received: from ip-172-31-24-42.ap-northeast-1.compute.internal (ec2-35-75-15-180.ap-northeast-1.compute.amazonaws.com. [35.75.15.180]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b0052ae3bcb807sm1947178pfl.188.2022.07.12.06.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 06:40:05 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Joe Perches , Vasily Averin , Matthew WilCox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 04/15] mm/slab_common: cleanup kmalloc_track_caller() Date: Tue, 12 Jul 2022 13:39:34 +0000 Message-Id: <20220712133946.307181-5-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220712133946.307181-1-42.hyeyoo@gmail.com> References: <20220712133946.307181-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make kmalloc_track_caller() wrapper of kmalloc_node_track_caller(). Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Vlastimil Babka --- include/linux/slab.h | 17 ++++++++--------- mm/slab.c | 6 ------ mm/slob.c | 6 ------ mm/slub.c | 22 ---------------------- 4 files changed, 8 insertions(+), 43 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 4754c834b0e3..a0e57df3d5a4 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -651,6 +651,12 @@ static inline __alloc_size(1, 2) void *kcalloc(size_t n, size_t size, gfp_t flag return kmalloc_array(n, size, flags | __GFP_ZERO); } +void *__kmalloc_node_track_caller(size_t size, gfp_t flags, int node, + unsigned long caller) __alloc_size(1); +#define kmalloc_node_track_caller(size, flags, node) \ + __kmalloc_node_track_caller(size, flags, node, \ + _RET_IP_) + /* * kmalloc_track_caller is a special version of kmalloc that records the * calling function of the routine calling it for slab leak tracking instead @@ -659,9 +665,9 @@ static inline __alloc_size(1, 2) void *kcalloc(size_t n, size_t size, gfp_t flag * allocator where we care about the real place the memory allocation * request comes from. */ -extern void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller); #define kmalloc_track_caller(size, flags) \ - __kmalloc_track_caller(size, flags, _RET_IP_) + __kmalloc_node_track_caller(size, flags, \ + NUMA_NO_NODE, _RET_IP_) static inline __alloc_size(1, 2) void *kmalloc_array_node(size_t n, size_t size, gfp_t flags, int node) @@ -680,13 +686,6 @@ static inline __alloc_size(1, 2) void *kcalloc_node(size_t n, size_t size, gfp_t return kmalloc_array_node(n, size, flags | __GFP_ZERO, node); } - -extern void *__kmalloc_node_track_caller(size_t size, gfp_t flags, int node, - unsigned long caller) __alloc_size(1); -#define kmalloc_node_track_caller(size, flags, node) \ - __kmalloc_node_track_caller(size, flags, node, \ - _RET_IP_) - /* * Shortcuts */ diff --git a/mm/slab.c b/mm/slab.c index 81804921c538..da2f6a5dd8fa 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3665,12 +3665,6 @@ void *__kmalloc(size_t size, gfp_t flags) } EXPORT_SYMBOL(__kmalloc); -void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller) -{ - return __do_kmalloc(size, flags, caller); -} -EXPORT_SYMBOL(__kmalloc_track_caller); - /** * kmem_cache_free - Deallocate an object * @cachep: The cache the allocation was from. diff --git a/mm/slob.c b/mm/slob.c index c54aad6b106c..80cdbe4f0d67 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -530,12 +530,6 @@ void *__kmalloc(size_t size, gfp_t gfp) } EXPORT_SYMBOL(__kmalloc); -void *__kmalloc_track_caller(size_t size, gfp_t gfp, unsigned long caller) -{ - return __do_kmalloc_node(size, gfp, NUMA_NO_NODE, caller); -} -EXPORT_SYMBOL(__kmalloc_track_caller); - void *__kmalloc_node_track_caller(size_t size, gfp_t gfp, int node, unsigned long caller) { diff --git a/mm/slub.c b/mm/slub.c index a5b3a4484263..7c284535a62b 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4904,28 +4904,6 @@ int __kmem_cache_create(struct kmem_cache *s, slab_flags_t flags) return 0; } -void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller) -{ - struct kmem_cache *s; - void *ret; - - if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) - return kmalloc_large(size, gfpflags); - - s = kmalloc_slab(size, gfpflags); - - if (unlikely(ZERO_OR_NULL_PTR(s))) - return s; - - ret = slab_alloc(s, NULL, gfpflags, caller, size); - - /* Honor the call site pointer we received. */ - trace_kmalloc(caller, ret, s, size, s->size, gfpflags); - - return ret; -} -EXPORT_SYMBOL(__kmalloc_track_caller); - void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, int node, unsigned long caller) { -- 2.34.1