From patchwork Tue Mar 8 11:41:33 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: 12773567 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 D6639C433FE for ; Tue, 8 Mar 2022 11:42:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 783498D000B; Tue, 8 Mar 2022 06:42:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 730A48D0001; Tue, 8 Mar 2022 06:42:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6465D8D000B; Tue, 8 Mar 2022 06:42:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 572158D0001 for ; Tue, 8 Mar 2022 06:42:39 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0F7D6183084DA for ; Tue, 8 Mar 2022 11:42:39 +0000 (UTC) X-FDA: 79221031638.21.9EC2E72 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by imf13.hostedemail.com (Postfix) with ESMTP id 057742000A for ; Tue, 8 Mar 2022 11:42:37 +0000 (UTC) Received: by mail-pg1-f182.google.com with SMTP id c11so3818421pgu.11 for ; Tue, 08 Mar 2022 03:42:37 -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=NJODWLWI7+P4Y4wf9Goyx7nWejvl0xaH4jd1S+sBpGc=; b=k8DqROsNj3BWSNG2HVRj2m3y+wA/g1RB5ufaW5G7A1VfyTlpqnavG7Y+AXEIbYf6LO CQeU9DHNU7Uk2GkBYnTLXY2YE/UEppE8Qj1TSTiTEAu4/qVWu4fCymEufSGdwNM/IbkR 9mnZcPZDvpVlpepo9JHszhsl/PntsBcfeLgsA+CXe29/GkjBeBEelKB+saVHeAv5yHZ+ PF4wn+R5lVgcCz+a1R7wELDHwKDHEPc8kXdVdX1T9gx6EHcnem8AyUhc41CMP82Ff8UA obfS73XrO2zVNOq4kkECRHvM6D+DybvJKPdPsA9VX0LwkA9ct45SLx6GLyJCZ/2DPbMV nmgA== 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=NJODWLWI7+P4Y4wf9Goyx7nWejvl0xaH4jd1S+sBpGc=; b=noXqRc7DpwA1x8Nh754Ea6SuJ4cOyheN8d/ktMD1M4F17hWLvhyIqbTWOufOHnGrO0 ObvAfaaZ5E59v2lBF3LjJe34Rov3UxnzLWBoCGdolYZkkcSAEfWoAeMdakKp0k8XomsI mYu0TnmCzibYtbYKjyibwf5VwYaC0DBe6K09nQRKJP7nmYApHkiDYVj4b3Puzwc1zOyr Nv06av6jpJ4o8MK7NBkUDW7FZ29lmGlWwYfE1pk3TocKl7Y2NGrzTG0Ivn0A7ZP6Fs7M 15nWPeCdArZKgpsOmat1EkVM0D3ILslB6vZY7FM2+62btxF8ukSPvuzzGr22axbaV3l4 /7bQ== X-Gm-Message-State: AOAM5322oLsa6+2A2laDnU+5itMEaVC1eT10IL6nYub5Y/VVZjh/ltGT 8FJWrDL2j0OFeZXUnPc7hl66rhF3tlkBTQ== X-Google-Smtp-Source: ABdhPJyfjhk94lYAce75iEXeUf2t8Pcrxd7uSvQMXJhrHla2T9WmCnuYSkcYeNf816yPaaO3IIbsMg== X-Received: by 2002:a63:8742:0:b0:37c:94b7:4fba with SMTP id i63-20020a638742000000b0037c94b74fbamr13501881pge.507.1646739756570; Tue, 08 Mar 2022 03:42:36 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 03:42:36 -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 06/15] mm/slab_common: cleanup kmalloc_large() Date: Tue, 8 Mar 2022 11:41:33 +0000 Message-Id: <20220308114142.1744229-7-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: rspam05 X-Rspamd-Queue-Id: 057742000A X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=k8DqROsN; spf=pass (imf13.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.215.182 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: jf8tzdgr8jmtkdw119n5xfhzcqcnr1tz X-HE-Tag: 1646739757-357665 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: Now that kmalloc_large() and kmalloc_large_node() do same job, make kmalloc_large() wrapper of kmalloc_large_node(). This makes slab allocators to use kmalloc_node tracepoint in kmalloc_large(). Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- include/linux/slab.h | 8 +++++--- mm/slab_common.c | 24 ------------------------ 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 60d27635c13d..8840b2d55567 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -467,12 +467,14 @@ 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(size_t size, gfp_t flags) __assume_page_alignment - __alloc_size(1); - extern void *kmalloc_large_node(size_t size, gfp_t flags, int node) __assume_page_alignment __alloc_size(1); +static __always_inline void *kmalloc_large(size_t size, gfp_t flags) +{ + return kmalloc_large_node(size, flags, NUMA_NO_NODE); +} + /** * kmalloc - allocate memory * @size: how many bytes of memory are required. diff --git a/mm/slab_common.c b/mm/slab_common.c index f61ac7458829..1fe2f2a7326d 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -932,30 +932,6 @@ 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_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); - - flags |= __GFP_COMP; - page = alloc_pages(flags, order); - if (likely(page)) { - ret = page_address(page); - mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, - PAGE_SIZE << order); - } - ret = kasan_kmalloc_large(ret, size, flags); - /* As ret might get tagged, call kmemleak hook after KASAN. */ - kmemleak_alloc(ret, size, 1, flags); - trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE << order, flags); - return ret; -} -EXPORT_SYMBOL(kmalloc_large); - void *kmalloc_large_node(size_t size, gfp_t flags, int node) { struct page *page;