Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1764296pxb; Thu, 14 Apr 2022 13:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6XxVAQFpG9BFNN7bYW51DuPV91udHG++KTqrAhxeUXBl8Szyk1VE8sGPTj6B6chfGv6Ie X-Received: by 2002:a05:6402:2681:b0:419:4564:1bd4 with SMTP id w1-20020a056402268100b0041945641bd4mr4997448edd.358.1649968439266; Thu, 14 Apr 2022 13:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649968439; cv=none; d=google.com; s=arc-20160816; b=TKMM2G2tcRmxrFQk0Eim+vJWtQUGt2/EqUv6SK1Dra1dByovPs87/8O8pxAUsXUhA0 FR1kWo9zZEHyTmctQyB6jQCT9WMYO+X6UIIZTu3xL/rh5FZc1nlX950Nex5WGrr0F2H9 ZinUCOmzk66ninvf/vPY+CjGxcnprHLz8SOL3jOrpfSCTIPyOtKme3x2R31hc2qFZJUu AehgbhO0i+XWndCj8hTJ15DiW8brYB6K1sHEFeFxQGcMK0naD9rHlAJDoqIUjW0+v0da dBnRWgz7dApDBzLHYYOU9QeIzPniaI6Q8alFtN1nNNV3skhyuthzsiQ/TJqO8BWE0S2N JcxQ== 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=FlV8ZEK41ZdMIfwkF7+gZmKxcQ8uBvSWc85Gpkn7FwU=; b=bTRTv2sttwaPuO96V+L6NkBEr6R9lvWy6QbKYB1KoYSPbyZMNHJ7t3MMB3R9nkgji1 UXvRriahVeuaLPHosAw++HIHtY8sgfyl9LZhzhAjUQzE0+yA7/pK3yO2fzLLNY9cgc0U 8819wyi59pfYqJk2lrtKYcF7RFdjDerauVGEe+GNk99reKKc7T+2o2UWBeroJwv4xbAl ecekiuvw8QCgMTR1ktYvjHak4c0AmTJufN5omH6a5LOCM+mN4BI+pEo8JGzeDq7dCBY/ 3+JFMOP9UyRvRRIWu+qbxCNgz7JcDwhiSyLmDE5yxg7BQEIvf8DRziVD+sC+6ivCeG4o eJ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RubjxjJE; 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 mh23-20020a170906eb9700b006df76385df3si2612693ejb.659.2022.04.14.13.33.17; Thu, 14 Apr 2022 13:33:59 -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=RubjxjJE; 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 S241349AbiDNJBY (ORCPT + 99 others); Thu, 14 Apr 2022 05:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241374AbiDNJBD (ORCPT ); Thu, 14 Apr 2022 05:01:03 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45A2E6BDD1 for ; Thu, 14 Apr 2022 01:58:35 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id f3so4287564pfe.2 for ; Thu, 14 Apr 2022 01:58:35 -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=FlV8ZEK41ZdMIfwkF7+gZmKxcQ8uBvSWc85Gpkn7FwU=; b=RubjxjJED6Mw2ADHs9bC6pFF/8ixEw2g9qX1cjRSx/QoRTFS+aCl/M/LClPmVSB/Ar hUcRjn3NB0Pm8HSMAvEpsHx0mw/7A3gGoqxg5WHW6wo/VbNffgIDqlwAZJJqRqh6iqnl V2aVPMB/JyjUFKCu0HnMMjO7f9F9eAahWb3d5YeUosdMbdlAHGcYG8RxoSNToK1zZ0Tw hjfZen2/EZsE0tEprZfscu94f65wy7/H5Xqp94d01zPuaU7+0yHqgI9oLcR4l73SRYqH M5UB6pkQkTYLn7GOirpdaaHFy7F/7drJz6a4hDl6a5igt9StPR8Y0lNVzY6tKbADs5te yHVw== 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=FlV8ZEK41ZdMIfwkF7+gZmKxcQ8uBvSWc85Gpkn7FwU=; b=EfcLo7hv1I/ALfsaSlD4snLJpjmkraKVFYdXOL56uzuPAK/tGnbZy/P2DurFf6sNZ6 gj7VrKk8jLIz3+n4ZiUVPPjOrceyEvsZsSEOXdCVDGWroBtykhc4ypc6OTiyj5mgJyFm CwXR89MVoCHBIP+ZXF5b8tewR0ReDG8vGuex63ufDkQluwAyMI3o6deOudWapV6aXiey YNSk6kRF9t+e/Ec/siKpguIczdJJeoPoRjkshRLCrOfkHa0LDC2UHsZ2wis8xKd1BizD we8Tlpp6I6eMzhY0R9UQ4p0SQaDpVIyQntt+n9LxbxFFWzuEhkclRzJUfYU/p2rw0Vj3 aNuA== X-Gm-Message-State: AOAM533ggVmUe0+RhcteTv/piP06M9pgOgT8jxZlJHPDwBiGII8TwhrC JNIA5R5bLdBLfn4uj5qiCQQ= X-Received: by 2002:a05:6a00:1341:b0:4fa:a3af:6ba3 with SMTP id k1-20020a056a00134100b004faa3af6ba3mr2847232pfu.51.1649926714563; Thu, 14 Apr 2022 01:58:34 -0700 (PDT) Received: from hyeyoo.. ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id p9-20020aa79e89000000b00505fada20dfsm1403537pfq.117.2022.04.14.01.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 01:58:33 -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 09/23] mm/slab_common: cleanup kmalloc_large() Date: Thu, 14 Apr 2022 17:57:13 +0900 Message-Id: <20220414085727.643099-10-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 Now that kmalloc_large() and kmalloc_large_node() do same job, make kmalloc_large() wrapper of kmalloc_large_node(). Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- include/linux/slab.h | 9 ++++++--- mm/slab_common.c | 24 ------------------------ 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 97336acbebbf..143830f57a7f 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -484,11 +484,14 @@ static __always_inline void *kmem_cache_alloc_node_trace(struct kmem_cache *s, g } #endif /* CONFIG_TRACING */ -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 cf17be8cd9ad..30684efc89d7 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -925,30 +925,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; -- 2.32.0