From patchwork Tue Mar 8 11:41:31 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: 12773565 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 98BACC433EF for ; Tue, 8 Mar 2022 11:42:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33BBA8D0009; Tue, 8 Mar 2022 06:42:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2EB588D0001; Tue, 8 Mar 2022 06:42:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20D998D0009; Tue, 8 Mar 2022 06:42:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 1235B8D0001 for ; Tue, 8 Mar 2022 06:42:32 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DF2A424137 for ; Tue, 8 Mar 2022 11:42:31 +0000 (UTC) X-FDA: 79221031302.15.1112941 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf25.hostedemail.com (Postfix) with ESMTP id 64484A0004 for ; Tue, 8 Mar 2022 11:42:31 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id 9so16825400pll.6 for ; Tue, 08 Mar 2022 03:42:31 -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=LZZ8fVjHeh5I8K2sKzZs1QzAUbB02xCOg/5s4cz8cRE=; b=Z0oYgAKXyrIqwEuVfeU9cRh9YSUCIwuYqlBz0A5lt34OhAd57AXF+Y0lX9rXFz8x6p FZkwKTbRMbsc5VcJOvSnTnqF+ngaUmOfPl1gV73IolqJwlLp8C5GBcY6UW031L/IvigT 6g89/ykep7HdizJ/gZeGckX5WtQTwPl1CFYr9dSZbd07d7kK4K0lyTBoEU6EBnr30E7r bF7bTM437Fs15hzqWQAfxCgxKFpg952oWG4TMO1wz82Xc6v2IYuh5bTkhZxU0liQax7y WWW27wEXdq3cJcesxWt0yPziZhPrG74pZPUxNNm5U5mSQjTGTzvHA07W+2mWOXJ2zhL1 PRKw== 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=LZZ8fVjHeh5I8K2sKzZs1QzAUbB02xCOg/5s4cz8cRE=; b=B4ctKiR+/NIDts8UE4/vAPItCc9PB+xVaiDaneKrV03WxBNPEt7U+ZcYNI5omNKj2b Ki14RRWkMuekDgzo+6RONihqHCOGdAxw3xhXJB4qLikF9eOUdOeveVbsguyvTGXBznkt KieM87g7ou4sY15ya/KAA6FKFNZkw+kbL2TGuNoVHPnqVRRqyyBfJnRWkQcHCn7/VEg+ CrT5EGsq6GEzYhyBs6P5OVTDP/mBchCX6HGczZfesd4sQyly9pX34ejD6oHGru9+VS2G FMRiZXCTTNZi/7UKh7tZeSETpraJuUii/UKCxOMY1yaActgIgMy5XdsSWbqopcfr+rDg Vx2A== X-Gm-Message-State: AOAM530rDOyXqL518BMGZVjEIpYjBmdpttocTRF6aIe3T3KND9+EOnI4 /l8aykycD9XPgYomQJ1Q366zyHVG8u/Z5g== X-Google-Smtp-Source: ABdhPJx+ihLWlNgAYhaAy4bGA/WKuwXn/5j/3Ommdre35Kbi9XjhlStDw4zZU1DSbUDjF8uSjpmUEg== X-Received: by 2002:a17:902:d4c9:b0:151:d074:cbe8 with SMTP id o9-20020a170902d4c900b00151d074cbe8mr16210397plg.102.1646739750183; Tue, 08 Mar 2022 03:42:30 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 03:42:29 -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 04/15] mm/sl[auo]b: fold kmalloc_order() into kmalloc_large() Date: Tue, 8 Mar 2022 11:41:31 +0000 Message-Id: <20220308114142.1744229-5-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-Queue-Id: 64484A0004 X-Stat-Signature: dh7npssabi1sh765bfw195na3z1q18zd X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Z0oYgAKX; spf=pass (imf25.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam07 X-HE-Tag: 1646739751-64486 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: There is no caller of kmalloc_order() except kmalloc_large(). Fold it into kmalloc_large() and remove kmalloc_order{,_trace}(). Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Vlastimil Babka --- include/linux/slab.h | 13 ++----------- mm/slab_common.c | 12 +++--------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index a5e3ad058817..aa14aba2b068 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -467,17 +467,8 @@ 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_order(size_t size, gfp_t flags, unsigned int order) __assume_page_alignment - __alloc_size(1); - -extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order) - __assume_page_alignment __alloc_size(1); - -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 diff --git a/mm/slab_common.c b/mm/slab_common.c index 2edb77056adc..1ba479f9d143 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -932,10 +932,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); @@ -950,17 +951,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); - -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); +EXPORT_SYMBOL(kmalloc_large); #ifdef CONFIG_SLAB_FREELIST_RANDOM /* Randomize a generic freelist */