Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp6205pxb; Thu, 14 Apr 2022 14:41:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXPmGU+j2ndWPp1jqsUoactZPksmf2NEgIAP8antnPmrF373R8UbbloYff9hDxqvJ9uTkU X-Received: by 2002:a65:55c7:0:b0:381:6a51:c496 with SMTP id k7-20020a6555c7000000b003816a51c496mr3767491pgs.525.1649972462134; Thu, 14 Apr 2022 14:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649972462; cv=none; d=google.com; s=arc-20160816; b=ceBmh81bccghYRoXAjo7vBRCtXS9S9cstINxCyIBQPL23ZmqKn0/rn91hz7YlG0JWU WniuBWukeIPJ6AstdJhLfDphACOFao+aI/PlD19YwxvNdtHMgs2Fgd+EhTKo2+l1R7e+ LqJh0BSomqphuiutswLB/DA1gtSyqymEk66VyUcRH5EDgwHnnNdf6Nu4o3ep8pv2CLAy HlR9/ikf5ERixwAfpoMK1ot2RISIilV6jlplgCHrPyOncoptGw/YFBoDM4TWLvH4sJo6 oVD/MiX+3waojGpHfoXluGC7FTwsQ+ZqCOPkdxNmPCyxPy0vxvCKObCHY6gjXLLxqFZf x5Iw== 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=Flouc9x4YW1EROU8wB1b7QSoEspFYDh7fC18OAMupnU=; b=t6KohPXQxX+EITRJglS3ZctQ0iBnG8j0QKgg0eYqVbOHV/vgBXCnO8WvQWy9NFATqN 0BDbiHvzJAdHHyCw2fMI4MGUAIfqk13Aps+UimjgPiRYOs1d6Tu60Ne9Eni0GF/7ASXj VyMQ8hBP7yTr3fcyq/YHNfIsQbk88CgFJCJSmr8clCDJubo6paTNDTV5obTRV9+vX7Pk sbQHFj7/4I05sKK4Qhsu3p0VNXlSIrENLenztOj+Lnz95CEFQkC1slxJdclD+YRqQXDi /SzWWPcqyS2B+WDSqulg4gFD/3YSMxLCp4V7ncb2U5lrG/HRAMGFHYZb/k5eD4kEhYD0 00mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="oony/Txz"; 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 fs1-20020a17090af28100b001cd4e41f205si2383270pjb.169.2022.04.14.14.40.44; Thu, 14 Apr 2022 14:41:02 -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="oony/Txz"; 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 S241337AbiDNJAx (ORCPT + 99 others); Thu, 14 Apr 2022 05:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241357AbiDNJAt (ORCPT ); Thu, 14 Apr 2022 05:00:49 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CF756BDD1 for ; Thu, 14 Apr 2022 01:58:16 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id h5so4224488pgc.7 for ; Thu, 14 Apr 2022 01:58:16 -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=Flouc9x4YW1EROU8wB1b7QSoEspFYDh7fC18OAMupnU=; b=oony/Txz5UItxFolta6iBfVnB8Y1xpXvK3iNV5pZyj98ppFo9RkGtVpwBS+DKI8QWO VwGRSP+JOqEQKfBIFD3st+33YwNN2BP25EYis48bexbK4VejcsLUZYH6XDcLI9Him/Cc pdL4JgTE8s4JX3p8FES71ZLoECOOogMnaangOCqpr0OoafDq3QrY56Or4zqI6gg3Rl4I 6PJpps2bvqQyRG8B5sAjDr83OMcBN8MiYs6T12aHSnzK6ovfvPD4vpB0khpULee6lrlv lMsscFikXRKquMov+dpptRT9c7vJXLJ4n2ViPI2dPNKB+x+S5Mt3HpQnOIq2ER68Z3th 5ltQ== 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=Flouc9x4YW1EROU8wB1b7QSoEspFYDh7fC18OAMupnU=; b=HytLoPdyMFqf2tDr2TWq0eFPvOJ1OVoLqvBjAozSuQo5hk1FV7racS0TKIyG61CdhU ZNGloXhKZY7jU04B1VvcCa+pCzUVsdNYb4W/zM7GxYNkDCKzrNJSkJhrfu91xP/OWJuW UrQDARvdu09+tVpVwSeQqUzW1IIOLoGCq43fDSeVW7E19jBdx+srvBMXYpqX0iEDn2di P3sPD8yd48cCU8kIRO4bk+F5NiQ0ZlpZUoFbbxJIpc6wt84n9z86sV1FtgqUtGEXMzcw 84lTzqrwgudEQ5jAkPzrZBanutVP30Uzc4PpY99RjIIipH3o+4u5C4FLT6TXoHl5JDi1 DdaQ== X-Gm-Message-State: AOAM531vQlPFbx1xxBsM1ULzt++ynMn8eJwKwQv/7L/dDRFdLaM3kK3M gb59K2ztv7RAohEiUPe2KYY= X-Received: by 2002:a05:6a00:1bca:b0:505:ac8b:cc4b with SMTP id o10-20020a056a001bca00b00505ac8bcc4bmr14022293pfw.26.1649926696025; Thu, 14 Apr 2022 01:58:16 -0700 (PDT) Received: from hyeyoo.. ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id p9-20020aa79e89000000b00505fada20dfsm1403537pfq.117.2022.04.14.01.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 01:58:14 -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 06/23] mm/sl[auo]b: fold kmalloc_order_trace() into kmalloc_large() Date: Thu, 14 Apr 2022 17:57:10 +0900 Message-Id: <20220414085727.643099-7-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.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 There is no caller of kmalloc_order_trace() except kmalloc_large(). Fold it into kmalloc_large() and remove kmalloc_order{,_trace}(). Also add tracepoint in kmalloc_large() that was previously in kmalloc_order_trace(). Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Vlastimil Babka --- Changes from v1: - updated some changelog (kmalloc_order() -> kmalloc_order_trace()) include/linux/slab.h | 22 ++-------------------- mm/slab_common.c | 14 +++----------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 4c06d15f731c..6f6e22959b39 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -484,26 +484,8 @@ static __always_inline void *kmem_cache_alloc_node_trace(struct kmem_cache *s, g } #endif /* CONFIG_TRACING */ -extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order) __assume_page_alignment - __alloc_size(1); - -#ifdef CONFIG_TRACING -extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order) - __assume_page_alignment __alloc_size(1); -#else -static __always_inline __alloc_size(1) void *kmalloc_order_trace(size_t size, gfp_t flags, - unsigned int order) -{ - return kmalloc_order(size, flags, order); -} -#endif - -static __always_inline __alloc_size(1) void *kmalloc_large(size_t size, gfp_t flags) -{ - unsigned int order = get_order(size); - return kmalloc_order_trace(size, flags, order); -} - +extern void *kmalloc_large(size_t size, gfp_t flags) __assume_page_alignment + __alloc_size(1); /** * kmalloc - allocate memory * @size: how many bytes of memory are required. diff --git a/mm/slab_common.c b/mm/slab_common.c index c4d63f2c78b8..308cd5449285 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -925,10 +925,11 @@ gfp_t kmalloc_fix_flags(gfp_t flags) * directly to the page allocator. We use __GFP_COMP, because we will need to * know the allocation order to free the pages properly in kfree. */ -void *kmalloc_order(size_t size, gfp_t flags, unsigned int order) +void *kmalloc_large(size_t size, gfp_t flags) { void *ret = NULL; struct page *page; + unsigned int order = get_order(size); if (unlikely(flags & GFP_SLAB_BUG_MASK)) flags = kmalloc_fix_flags(flags); @@ -943,19 +944,10 @@ void *kmalloc_order(size_t size, gfp_t flags, unsigned int order) ret = kasan_kmalloc_large(ret, size, flags); /* As ret might get tagged, call kmemleak hook after KASAN. */ kmemleak_alloc(ret, size, 1, flags); - return ret; -} -EXPORT_SYMBOL(kmalloc_order); - -#ifdef CONFIG_TRACING -void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order) -{ - void *ret = kmalloc_order(size, flags, order); trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE << order, flags); return ret; } -EXPORT_SYMBOL(kmalloc_order_trace); -#endif +EXPORT_SYMBOL(kmalloc_large); #ifdef CONFIG_SLAB_FREELIST_RANDOM /* Randomize a generic freelist */ -- 2.32.0