Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4409239imw; Tue, 12 Jul 2022 07:29:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tM5so0LwuPfNT/VrMhv905u5WruqBjdUKTzxtAbwGHVzLa3Uqvhxg6tzw0syKmNRQoeJ25 X-Received: by 2002:a63:8448:0:b0:412:a9f5:9db2 with SMTP id k69-20020a638448000000b00412a9f59db2mr20778477pgd.5.1657636194304; Tue, 12 Jul 2022 07:29:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657636194; cv=none; d=google.com; s=arc-20160816; b=dGsBGUjGtFyVfe9x3UuorUZj4RVYXASs2bZHDdIv3zwwbznMSRMVnqFc1eaSKzpHqh CV49UsEirfAjE9AFLehTdXh9U4AxmKDNz89MDrkRw6ouCEP1paN4Zqw3yrltSoFLMV07 SmgDIqYywHj8bA7CFCDM2TsrRnqO4yNl46F2ezc4fG/gHefw9S15M41qSiGX1m9iyGd4 nwlVIzW0h1uGWvU46qNqERf5tDJHkCiWwvE2XEb4Rh/MxSEhxbswgoooGNufmzMqmPF/ WzS5V0vXg3sZqpk0INJ/kOSYy4evL6GjSMd7RckqK22qjQUzL0TEzZCWE+ZqHE4DvWiB Jtxg== 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=1gwXwcTxbtqS306f0SRAhtNxfxeXqjslTrtEUxnOJNw=; b=U/tR/L7qNfdvYjH1uyzns2YJQQbuUmDOI8Rm/+JrdIQkIQJ77+Gs+FpnMGgLmt2Gf6 C/MB62HhE6wilhvdtfoCae4GtyaJxZApPzGuykp6rg7Brs3kycUJbZ/GGQaLcRPA9x2r HQkfy8BDH8T5whTtZ8ql8FgL9vQfpRTg7lBoqEFeY/+Mo0LD5YiAHcFV6pTZWhZ4hnI6 4FRIKPu5PiaNkA5oSxbHrVPgxaf3HX9LZwyr1IXnCKHdTQoyqt3KzEWYoefAkO4bamBG K0t9u6kiPGaaDqMVGORdR8y9awqr0/TyRSbrTVv3aCdnLc+ASh0H68lSIUqFdXzyU/5f 6Waw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BCoKGtiI; 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 u9-20020a170902e5c900b0016c01daae73si16760387plf.455.2022.07.12.07.29.40; Tue, 12 Jul 2022 07:29:54 -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=BCoKGtiI; 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 S233265AbiGLNkQ (ORCPT + 99 others); Tue, 12 Jul 2022 09:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233199AbiGLNkI (ORCPT ); Tue, 12 Jul 2022 09:40:08 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A50DAB655E for ; Tue, 12 Jul 2022 06:40:03 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id o3-20020a17090a744300b001ef8f7f3dddso8014839pjk.3 for ; Tue, 12 Jul 2022 06:40:03 -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=1gwXwcTxbtqS306f0SRAhtNxfxeXqjslTrtEUxnOJNw=; b=BCoKGtiIYwndVeEjknYETv1h9O/+3SP5RRacoN1ak4QTh9SzE6i/tUYYmWh8zFxNmY Pkdd6EOifVnZwZkTUQjvG8AvF3GpJ9JF3iauraj4OLKEYUouc1RtQk/iXIsvzyMnsVmu cwoXbEtFkGrj8ynvr03lfdsu4HAps3BNvgNDYglyC0LliGKQ0+m3OOOBYgN4mma4vyGh jqe6H5gf5Be7uy9KdoRK01ZYeXy+VwFkttgU7IG/pVLyQ9Fa9vZ0Mr4e6GIKP/bPmzSY NjVqWUAdKh/+r5iv3rHasQ3Niq7pnidg/B4ojuMciWxPpM/940QOqakFDP6cvBDEHF4u 35LA== 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=1gwXwcTxbtqS306f0SRAhtNxfxeXqjslTrtEUxnOJNw=; b=GSn+RTMKU5iVzI1ctGF8C3SRr6sVLqr+9n5R8YGqydkFpXcvfH+iFV3VLeElpnPVtn 2H5XOBJZYb2VjVSHteVt1a59fRpgBfrh0ThBcE4DcrjghJQCeMnIr0Z7AH3QII/YJKru yq4UFz1z0Xr+/rlp2HL3aRe/XM3G3xn0ax+WaJwTvOHHXrpaejYRHUhPrj7joKRzP7Cd lS43zhjtI2jkJsbsuHpMiZTZQFiHmnxsOKIZjxPZWNBl5kR/aNexrHHESuZqMW2v2L7f z9NyQeZwJSLjyV/+1xGXbrxobrDpwKc0EHra0wPoDlIPowRlZCTUjeb1diVK4WzfCChS oBlQ== X-Gm-Message-State: AJIora/dL9VZUwxoKEOgoyE79zVFpiX3+Taw7cZqc5ZnIrvALBZCrfL+ iYgERDfUFw0amehSLMpiqbQ= X-Received: by 2002:a17:90b:3841:b0:1ef:f0ac:de55 with SMTP id nl1-20020a17090b384100b001eff0acde55mr4565802pjb.35.1657633202990; Tue, 12 Jul 2022 06:40:02 -0700 (PDT) Received: from ip-172-31-24-42.ap-northeast-1.compute.internal (ec2-35-75-15-180.ap-northeast-1.compute.amazonaws.com. [35.75.15.180]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b0052ae3bcb807sm1947178pfl.188.2022.07.12.06.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 06:40:02 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Joe Perches , Vasily Averin , Matthew WilCox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 03/15] mm/slab_common: remove CONFIG_NUMA ifdefs for common kmalloc functions Date: Tue, 12 Jul 2022 13:39:33 +0000 Message-Id: <20220712133946.307181-4-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220712133946.307181-1-42.hyeyoo@gmail.com> References: <20220712133946.307181-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 slab_alloc_node() is available for SLAB when CONFIG_NUMA=n, remove CONFIG_NUMA ifdefs for common kmalloc functions. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Vlastimil Babka --- include/linux/slab.h | 28 ---------------------------- mm/slab.c | 2 -- mm/slob.c | 5 +---- mm/slub.c | 6 ------ 4 files changed, 1 insertion(+), 40 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 0fefdf528e0d..4754c834b0e3 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -456,38 +456,18 @@ static __always_inline void kfree_bulk(size_t size, void **p) kmem_cache_free_bulk(NULL, size, p); } -#ifdef CONFIG_NUMA void *__kmalloc_node(size_t size, gfp_t flags, int node) __assume_kmalloc_alignment __alloc_size(1); void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node) __assume_slab_alignment __malloc; -#else -static __always_inline __alloc_size(1) void *__kmalloc_node(size_t size, gfp_t flags, int node) -{ - return __kmalloc(size, flags); -} - -static __always_inline void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t flags, int node) -{ - return kmem_cache_alloc(s, flags); -} -#endif #ifdef CONFIG_TRACING extern void *kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t flags, size_t size) __assume_slab_alignment __alloc_size(3); -#ifdef CONFIG_NUMA 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); -#else -static __always_inline __alloc_size(4) void *kmem_cache_alloc_node_trace(struct kmem_cache *s, - gfp_t gfpflags, int node, size_t size) -{ - return kmem_cache_alloc_trace(s, gfpflags, size); -} -#endif /* CONFIG_NUMA */ #else /* CONFIG_TRACING */ static __always_inline __alloc_size(3) void *kmem_cache_alloc_trace(struct kmem_cache *s, @@ -701,20 +681,12 @@ static inline __alloc_size(1, 2) void *kcalloc_node(size_t n, size_t size, gfp_t } -#ifdef CONFIG_NUMA extern void *__kmalloc_node_track_caller(size_t size, gfp_t flags, int node, unsigned long caller) __alloc_size(1); #define kmalloc_node_track_caller(size, flags, node) \ __kmalloc_node_track_caller(size, flags, node, \ _RET_IP_) -#else /* CONFIG_NUMA */ - -#define kmalloc_node_track_caller(size, flags, node) \ - kmalloc_track_caller(size, flags) - -#endif /* CONFIG_NUMA */ - /* * Shortcuts */ diff --git a/mm/slab.c b/mm/slab.c index 5ca8bb7335dc..81804921c538 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3535,7 +3535,6 @@ kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size) EXPORT_SYMBOL(kmem_cache_alloc_trace); #endif -#ifdef CONFIG_NUMA /** * kmem_cache_alloc_node - Allocate an object on the specified node * @cachep: The cache to allocate from. @@ -3609,7 +3608,6 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t flags, return __do_kmalloc_node(size, flags, node, caller); } EXPORT_SYMBOL(__kmalloc_node_track_caller); -#endif /* CONFIG_NUMA */ #ifdef CONFIG_PRINTK void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab) diff --git a/mm/slob.c b/mm/slob.c index 56421fe461c4..c54aad6b106c 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -536,14 +536,12 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfp, unsigned long caller) } EXPORT_SYMBOL(__kmalloc_track_caller); -#ifdef CONFIG_NUMA void *__kmalloc_node_track_caller(size_t size, gfp_t gfp, int node, unsigned long caller) { return __do_kmalloc_node(size, gfp, node, caller); } EXPORT_SYMBOL(__kmalloc_node_track_caller); -#endif void kfree(const void *block) { @@ -647,7 +645,7 @@ void *kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *lru, gfp_ return slob_alloc_node(cachep, flags, NUMA_NO_NODE); } EXPORT_SYMBOL(kmem_cache_alloc_lru); -#ifdef CONFIG_NUMA + void *__kmalloc_node(size_t size, gfp_t gfp, int node) { return __do_kmalloc_node(size, gfp, node, _RET_IP_); @@ -659,7 +657,6 @@ void *kmem_cache_alloc_node(struct kmem_cache *cachep, gfp_t gfp, int node) return slob_alloc_node(cachep, gfp, node); } EXPORT_SYMBOL(kmem_cache_alloc_node); -#endif static void __kmem_cache_free(void *b, int size) { diff --git a/mm/slub.c b/mm/slub.c index 26b00951aad1..a5b3a4484263 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3287,7 +3287,6 @@ void *kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size) EXPORT_SYMBOL(kmem_cache_alloc_trace); #endif -#ifdef CONFIG_NUMA void *kmem_cache_alloc_node(struct kmem_cache *s, gfp_t gfpflags, int node) { void *ret = slab_alloc_node(s, NULL, gfpflags, node, _RET_IP_, s->object_size); @@ -3314,7 +3313,6 @@ void *kmem_cache_alloc_node_trace(struct kmem_cache *s, } EXPORT_SYMBOL(kmem_cache_alloc_node_trace); #endif -#endif /* CONFIG_NUMA */ /* * Slow path handling. This may still be called frequently since objects @@ -4427,7 +4425,6 @@ void *__kmalloc(size_t size, gfp_t flags) } EXPORT_SYMBOL(__kmalloc); -#ifdef CONFIG_NUMA static void *kmalloc_large_node(size_t size, gfp_t flags, int node) { struct page *page; @@ -4474,7 +4471,6 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node) return ret; } EXPORT_SYMBOL(__kmalloc_node); -#endif /* CONFIG_NUMA */ #ifdef CONFIG_HARDENED_USERCOPY /* @@ -4930,7 +4926,6 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller) } EXPORT_SYMBOL(__kmalloc_track_caller); -#ifdef CONFIG_NUMA void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, int node, unsigned long caller) { @@ -4960,7 +4955,6 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags, return ret; } EXPORT_SYMBOL(__kmalloc_node_track_caller); -#endif #ifdef CONFIG_SYSFS static int count_inuse(struct slab *slab) -- 2.34.1