Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp989638pxb; Fri, 15 Apr 2022 17:35:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyztZK/V0WDkvDecWlWkaoCVNuEkl5WgRVzFLhfc2RHBGAOrJTZPeipErN9XoJ7WW8EyMzv X-Received: by 2002:a05:6a00:23d2:b0:4fa:f262:719 with SMTP id g18-20020a056a0023d200b004faf2620719mr1424745pfc.4.1650069299623; Fri, 15 Apr 2022 17:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650069299; cv=none; d=google.com; s=arc-20160816; b=yyqGdCT05AFFg1p/LmBooIuU0bumaPduv37FEV6TBRMGyaNBXO/Q787RymZuX7k717 8pOTcrZUe7bI/BXyb60v3MM9N5/ukP3XY0+3e8IV4JAkBYXV3oL8COG3klNref8BtDt8 eKsdBh5XG9y8FKY65AkkHk+qOCPLbHI/orKu5gzm+20owaxidmjdU8TfPybu3ch6v9Mq adQPrTdBKAgwqj3NYFGuXAB7TzGDSVdkT6QpgUIE/QPcdSFqey1uRELt/y+DacdJxP+1 WNXFNmuBpm+A/SZX5WfE7lXJjSvRKQCGIjnqaCNvJAH634uyBKUVCgqco1Lu5W2yVoIf 76cw== 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=l9QL4BycKE4eFXdrmUENq07WhnIQYOOU7butyGlrlts=; b=tJutm2Zlo5E5VS9G6Z+q2DFyZk9GM7JX4po2hlGD7uhcQPPvoBIY7c53+R8eLid9TV 6rN+gv2O9yf/9dLTLUUGi7ruFwn8XdK7ASaJtcwxUdZvw+f/WMuuxXu9cx5Fg6zuTtTH GpT1GTKcW7OQCFrtmIgoIqF26dA0zomYtZfmZjSZiA+QLje0yvMT+cVGh1y0rEW3E4IE GLXYOlG142WWWFWdbTRWuD5ZvDzJ5imCd3q9023LvEA1uVpRVZfDnKJwY9nq2rblMkvb nhQd7Q+TkvelObbm0WVYFtVcfgPB9/9esbnEFfKwyLOFTQuuGMcUide6mCJZvSVttjgG kziw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oLxmbrdr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m2-20020a17090ade0200b001ca8fbc8944si2739922pjv.123.2022.04.15.17.34.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oLxmbrdr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5968AF3291; Fri, 15 Apr 2022 17:31:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241434AbiDNJEr (ORCPT + 99 others); Thu, 14 Apr 2022 05:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241466AbiDNJCN (ORCPT ); Thu, 14 Apr 2022 05:02:13 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FEB62657F for ; Thu, 14 Apr 2022 01:59:49 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id c23so4173530plo.0 for ; Thu, 14 Apr 2022 01:59:49 -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=l9QL4BycKE4eFXdrmUENq07WhnIQYOOU7butyGlrlts=; b=oLxmbrdrrSYOas267DSbgnV7X8Q/M59tbvkzw39YowuMa64Stzy1Sc8jRluxQdezP0 l1U5kP+u3MOVEuii/WM2XiAh4B58+UWrMK8YwohsdbefFYmO/oHVr8S66x2ZpuxhG44x 4Z4Oc+GPnUvwz/ShIKcgm74rGBZLYTuHCRpl+x/SbY11vbucdT/KaTNwb4B6O35Y4NAg Ka3rTgD2CJnenUkq3d2MuHWGZneo6s2DoYCL5GSoIM8BvRFOjFLb+MDcs6cQ2Zod9Y9v qW8iJh3R5ZK/Rihp8i1pWxhoUpxne6sbZs/VxMXWAMdjRn/cNTEWx5lrUVSUNwpnjhJS w8IQ== 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=l9QL4BycKE4eFXdrmUENq07WhnIQYOOU7butyGlrlts=; b=5pQew7exTuE9ZSLiw6j0guM4t87P3pZ3DsPzcFqUgxSpg4OAM3d2EK2UlebafAwAE5 plhZzcM4sOxhIPqTaMzxkuJkX35c6G3aJuHKqDBefgf0O1fuZ/Ng9ooxjxjHgb3ty2K9 OXTiN6NPgnSjdm1m3jMyI0OovlxlhhlqXVX7hf2V0J+46Q2dwkGgGCMWPTpz7PV9wMmc YyGiY0CwBdPf21/X2GV3Nje54ZjqOXwk2faJyxWh+TPy65yq0ZK9TSkRn2mW5ghCjhm5 qVzaNrY3YrtrlqSL8TlqogL2qSsChofPIi0KQAq1k38kwoPykfP+emAykS34s+2tJgOk kyuA== X-Gm-Message-State: AOAM5333ex5z3IqIhT+rV1Epwf7byn7YmVAQX1Fpmlp5BLCWK54XSZD1 9QHscFNErzsWeJ4eFRvoUGE= X-Received: by 2002:a17:90b:4f8d:b0:1c6:408b:6b0d with SMTP id qe13-20020a17090b4f8d00b001c6408b6b0dmr3217496pjb.90.1649926789022; Thu, 14 Apr 2022 01:59:49 -0700 (PDT) Received: from hyeyoo.. ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id p9-20020aa79e89000000b00505fada20dfsm1403537pfq.117.2022.04.14.01.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 01:59:47 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka Cc: Marco Elver , Matthew WilCox , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 21/23] mm/sl[au]b: remove kmem_cache_alloc_node_trace() Date: Thu, 14 Apr 2022 17:57:25 +0900 Message-Id: <20220414085727.643099-22-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220414085727.643099-1-42.hyeyoo@gmail.com> References: <20220414085727.643099-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,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 kmem_cache_alloc_node_trace() was introduced by commit 4a92379bdfb4 ("slub tracing: move trace calls out of always inlined functions to reduce kernel code size") to avoid inlining tracepoints for inlined kmalloc function calls. Now that we use same tracepoint in kmalloc and normal caches, kmem_cache_alloc_node_trace() can be replaced with __kmem_cache_alloc_node() and kasan_kmalloc(). Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- include/linux/slab.h | 26 ++++++++------------------ mm/slab.c | 19 ------------------- mm/slub.c | 16 ---------------- 3 files changed, 8 insertions(+), 53 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 0630c37ee630..c1aed9d97cf2 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -497,21 +497,6 @@ static __always_inline void kfree_bulk(size_t size, void **p) kmem_cache_free_bulk(NULL, size, p); } -#ifdef CONFIG_TRACING -extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s, gfp_t gfpflags, - int node, size_t size) __assume_slab_alignment - __alloc_size(4); -#else /* CONFIG_TRACING */ -static __always_inline void *kmem_cache_alloc_node_trace(struct kmem_cache *s, gfp_t gfpflags, - int node, size_t size) -{ - void *ret = kmem_cache_alloc_node(s, gfpflags, node); - - ret = kasan_kmalloc(s, ret, size, gfpflags); - return ret; -} -#endif /* CONFIG_TRACING */ - extern void *kmalloc_large_node(size_t size, gfp_t flags, int node) __assume_page_alignment __alloc_size(1); @@ -523,6 +508,9 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) #ifndef CONFIG_SLOB static __always_inline __alloc_size(1) void *kmalloc_node(size_t size, gfp_t flags, int node) { + struct kmem_cache *s; + void *objp; + if (__builtin_constant_p(size)) { unsigned int index; @@ -534,9 +522,11 @@ static __always_inline __alloc_size(1) void *kmalloc_node(size_t size, gfp_t fla if (!index) return ZERO_SIZE_PTR; - return kmem_cache_alloc_node_trace( - kmalloc_caches[kmalloc_type(flags)][index], - flags, node, size); + s = kmalloc_caches[kmalloc_type(flags)][index]; + + objp = __kmem_cache_alloc_node(s, NULL, flags, node, _RET_IP_); + objp = kasan_kmalloc(s, objp, size, flags); + return objp; } return __kmalloc_node(size, flags, node); } diff --git a/mm/slab.c b/mm/slab.c index fc00aca62ae3..24010e72f603 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3508,25 +3508,6 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, } EXPORT_SYMBOL(kmem_cache_alloc_bulk); -#ifdef CONFIG_TRACING -void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep, - gfp_t flags, - int nodeid, - size_t size) -{ - void *ret; - - ret = slab_alloc_node(cachep, NULL, flags, nodeid, size, _RET_IP_); - - ret = kasan_kmalloc(cachep, ret, size, flags); - trace_kmem_cache_alloc(cachep->name, _RET_IP_, ret, - size, cachep->size, - flags, nodeid); - return ret; -} -EXPORT_SYMBOL(kmem_cache_alloc_node_trace); -#endif - #ifdef CONFIG_PRINTK void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) { diff --git a/mm/slub.c b/mm/slub.c index bc9c96ce0521..1899c7e1de10 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3222,22 +3222,6 @@ void *__kmem_cache_alloc_node(struct kmem_cache *s, struct list_lru *lru, gfp_t } EXPORT_SYMBOL(__kmem_cache_alloc_node); -#ifdef CONFIG_TRACING -void *kmem_cache_alloc_node_trace(struct kmem_cache *s, - gfp_t gfpflags, - int node, size_t size) -{ - void *ret = slab_alloc_node(s, NULL, gfpflags, node, _RET_IP_, size); - - trace_kmem_cache_alloc(s->name, _RET_IP_, ret, - size, s->size, gfpflags, node); - - ret = kasan_kmalloc(s, ret, size, gfpflags); - return ret; -} -EXPORT_SYMBOL(kmem_cache_alloc_node_trace); -#endif - /* * Slow path handling. This may still be called frequently since objects * have a longer lifetime than the cpu slabs in most processing loads. -- 2.32.0