From patchwork Tue Mar 8 11:41:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 12773574 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 4A1EBC433EF for ; Tue, 8 Mar 2022 11:43:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9AA48D0012; Tue, 8 Mar 2022 06:43:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D4A548D0001; Tue, 8 Mar 2022 06:43:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEB1E8D0012; Tue, 8 Mar 2022 06:43:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id B12468D0001 for ; Tue, 8 Mar 2022 06:43:01 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 649711830AFCA for ; Tue, 8 Mar 2022 11:43:01 +0000 (UTC) X-FDA: 79221032562.27.51979F6 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf13.hostedemail.com (Postfix) with ESMTP id 2D85F20005 for ; Tue, 8 Mar 2022 11:42:59 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id n2so7314628plf.4 for ; Tue, 08 Mar 2022 03:42:59 -0800 (PST) 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=qUPv+czHu+ddxgZ8oS0ewjwH+jitPnbHg1+sr8pOpYg=; b=G85/TCA5cJn/gdgyKVVMiRrVQa4IJvnrVAVddno0iqZqfKkxMScN5MUN/1r3QDUj5l oQqQ/O1DMYPRqam5/slZ3iu7wI1+aOk6ThNdibALhfW+keQXjrQzbw0LgsbYvzbbKA3s qQboPhxljlWY6DAYBxiBol1vIBTDS4o20gBPVEhbMhRLr6o5hwseTHDYL+DPeKz9TzGl cH+O8IUmk+geLIImbcNI57rSJzfEYEnXu6a+6Che/9Hmu/fqqS8iQc/VmuL2XTXWpY/T jfk50yhnx0HqcyKtOrTm7ribD8/BA7OGE7kAR4x0Y3nnmQRe0zWTvXiLI8VO9sGUHX8b SsJQ== 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=qUPv+czHu+ddxgZ8oS0ewjwH+jitPnbHg1+sr8pOpYg=; b=S3G0TwhL7nXryIDvsAWKv5cj7fKK+GaA+H8DNXk/VQnR1+S95l83hqVxWJn1Ig/lll fqHEXZmC+hCA3Af5vKBRGnJLF1XT7N2uzMtHKsjPL8DnY1RWRkcezoyhulThWhhAwtMq l5F/F0tVaB7aIJfvpj9IGDBpmZw3VjrZw0psu/d2u44XoSrP//r+h14/Co1nSTuTC+hB S0dc1XOWV35u625uLrYRJnLCDocxhV+hB6TQoDDch01yTnQLFhmlsjT9i/yVSQJRiYCR aAkUjE2darKjG6NCbySyDo1cyVpmVlAjNrCUyYZhxVC0Ty/97yiXxfxyUTdioeZ7gNfp uzAw== X-Gm-Message-State: AOAM533eT/I2CfNL84vRrtXqFUFd4m1zoMQ2NpK4UrHVdaRCf3C4vXar 5E9aHniWI7h10ajT8nDCHiZjZlgQQOtVEQ== X-Google-Smtp-Source: ABdhPJwpAmeD5MxtpUNKumLB7VVq1hmeVGqwhjbe/E/SlKyFascMG1F61KAp6t4bp87BqLUVr36lUQ== X-Received: by 2002:a17:90a:74c7:b0:1bf:5532:3ae8 with SMTP id p7-20020a17090a74c700b001bf55323ae8mr4124308pjl.120.1646739778875; Tue, 08 Mar 2022 03:42:58 -0800 (PST) Received: from ip-172-31-19-208.ap-northeast-1.compute.internal (ec2-18-181-137-102.ap-northeast-1.compute.amazonaws.com. [18.181.137.102]) by smtp.gmail.com with ESMTPSA id i2-20020a17090ac40200b001bd0e552d27sm2578285pjt.11.2022.03.08.03.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 03:42:58 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: linux-mm@kvack.org Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Marco Elver , Matthew WilCox , Roman Gushchin , linux-kernel@vger.kernel.org, 42.hyeyoo@gmail.com Subject: [RFC PATCH v1 13/15] mm/sl[au]b: remove kmem_cache_alloc_node_trace() Date: Tue, 8 Mar 2022 11:41:40 +0000 Message-Id: <20220308114142.1744229-14-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220308114142.1744229-1-42.hyeyoo@gmail.com> References: <20220308114142.1744229-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2D85F20005 X-Stat-Signature: jtzon1kdxwjw5zzgdzknusym3etbgy9h Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="G85/TCA5"; spf=pass (imf13.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1646739779-987307 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: 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 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 6b632137f799..8da8beff712f 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -497,10 +497,6 @@ static __always_inline void kfree_bulk(size_t size, void **p) kmem_cache_free_bulk(NULL, size, p); } -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); - extern void *kmalloc_large_node(size_t size, gfp_t flags, int node) __assume_page_alignment __alloc_size(1); @@ -512,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; @@ -523,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, flags, node, _RET_IP_); + objp = kasan_kmalloc(s, objp, size, flags); + return objp; } return __kmalloc_node(size, flags, node); }