From patchwork Tue Jan 30 01:41:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Yejian X-Patchwork-Id: 13536665 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 100D2C47DA9 for ; Tue, 30 Jan 2024 01:39:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BC276B00A8; Mon, 29 Jan 2024 20:39:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 86C8F6B00A9; Mon, 29 Jan 2024 20:39:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75B276B00AA; Mon, 29 Jan 2024 20:39:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 661316B00A8 for ; Mon, 29 Jan 2024 20:39:38 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3CB3AC0B32 for ; Tue, 30 Jan 2024 01:39:38 +0000 (UTC) X-FDA: 81734270436.06.8290700 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf17.hostedemail.com (Postfix) with ESMTP id D971940009 for ; Tue, 30 Jan 2024 01:39:34 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of zhengyejian1@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=zhengyejian1@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706578776; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=p/LYQYhXrCyHx+FyC4OMbAg/v6z0n5e2cCz0WP/6YaM=; b=10lmmYaJRE+2Otstl1NaVHp5oKHOLuTO4kparcyTnzlzlbNe19t7oaSdEsbhnHC9F3Nrmb cuZ1DCF4BYVnxcLcHWqSYgY8f6KIkqBp4kWQhXtaW00EqrslhalASdUzqFbWIJa2af67h3 /Zj9C1GGwyH7yJUZTsJrbN69ioi/xbc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of zhengyejian1@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=zhengyejian1@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706578776; a=rsa-sha256; cv=none; b=ndL3g8RYW60HVtkUd20CXbAlq3daJhRI5nZT0BulEuTqBCKluSVLPrSQzsYGIwyj4yJY34 pQEvX33VL/nqhfoGyOExwKehxgCNXYRq0wDxbx6M1LnsODlI0Dr+VPJLF+HAR0STlmH8+W Fbqia/fRRZUioB8MwZ9lDUdXk1Wa9yY= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4TP7B16qH4z1vskm; Tue, 30 Jan 2024 09:39:05 +0800 (CST) Received: from dggpeml500012.china.huawei.com (unknown [7.185.36.15]) by mail.maildlp.com (Postfix) with ESMTPS id 708DD1404F1; Tue, 30 Jan 2024 09:39:30 +0800 (CST) Received: from localhost.localdomain (10.67.175.61) by dggpeml500012.china.huawei.com (7.185.36.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 30 Jan 2024 09:39:30 +0800 From: Zheng Yejian To: , , , , , , , <42.hyeyoo@gmail.com> CC: , , Subject: [PATCH] mm/slub: remove parameter 'flags' in create_kmalloc_caches() Date: Tue, 30 Jan 2024 09:41:07 +0800 Message-ID: <20240130014107.1262373-1-zhengyejian1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.67.175.61] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500012.china.huawei.com (7.185.36.15) X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: D971940009 X-Stat-Signature: 9s64s8hw19hqd3bq8ng7p7tojo698mot X-Rspam-User: X-HE-Tag: 1706578774-200109 X-HE-Meta: U2FsdGVkX1/7EK4qix2qEPOub/YkP404zn5Kz8XLOjnlbZXJPFWEoErhWvZSo+i9INH1JXa0pIhOI3SZK96XqpnDgCsF0iOh5bTJSPuhUwHqrmU+v5esr8u6SQ1arokhSNd+a8ssFDyQ9c2K9cdyGwEt8fGbVNOvSlNxGXkBobYi4hR9ljUXhzvFjCVCuAFcsP16Wc1GvUvjWHJoJ8HVYC3QG4hNoMpHiZca6HwqlXM6LTvSY3W3RzaWDdc4AmVxGz7Y6XArbnSdDeowX2EzXYb/aRcTLlIYPYiD6lPT1CaRSN6ACf4FZ+XGOr7djWyq1FicNmBjIMowtY4TmvAbpBOpZzSf/B0THlMpyXhTPeqxmyLBY6rno4jzsUVveAEIXJgrxRblJqAC0BLHewD7CHCqPPVpba+oDptom6ZyG8DA0cC+0Dm2WWcdBpiMZYWdZzY94FzAR05pUvW1NOVWAy7C3C2cBO8j/tt2o1rsNWJmVMr370068dCh8MQ1TWautXJbJ0/evUvq+1Zq+jSL7N3yacdbXm6Kc4yuSj71p5L6dLYHMf1m5fkL7DC1n150NsSrjbdqSGGSgxPCG1VPYNGztal0+4xbjTOI+RVi3k18vdB6IvqbPLye1u0NCroHSJ03NEuUHojvoth9apvK8t3mzk2i7sh5wubVcd4dpu/LMPY67zTknggyVu77cskdvqaIzguT/ULovhoJ4kys9rhLZnCLLxArS9vEMMVSFqvMTqqXNRCimt8Cqerh7Xvohp0AAjWvIQDOytYAUV8vo7pFCLGdDqT0nYwoZ0ErcHBH51nKe/80Nle0hce/GYZFkGCrQVCGLp9sz4+MyCs3GBFqpRPD9uo+i7OwQ1P6ttAY91Npu53upP/N2ppVjga1WR3aqGXu8oYUcU+IoHn7qtXIZ6BVX7HxmThGT/WeXuRMGZYqm2uNSnzetBRbLtNtmqB+ePdHzevcC3p/HFb 3JI/l48L 0wFU/N2vfOH5SFzSWUDfUzMg1s7KHjkx+9Bv74zBDJoreaxJik3pU/LBxDsz5tURNxLLTaLcxG6D4cw+as5IT30cQiHZ9VgT4P70H9rIEBUkrvxGBX8P2g0glaDMTCe5ilxaWYCYXWv6NGyq/nTyJnuNysstR9RIAjpjnXBRYy1DNoiHFTIV405j9mqHjF+kUMDnaMS/j3pwDngws+yDn4wVaWoVOaybmCCaslrObOIUn0sEgQ5a+qKXLhcecJBS+jMr0 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: List-Subscribe: List-Unsubscribe: After commit 16a1d968358a ("mm/slab: remove mm/slab.c and slab_def.h"), parameter 'flags' is only passed as 0 in create_kmalloc_caches(), and then it is only passed to new_kmalloc_cache(). So we can change parameter 'flags' to be a local variable with initial value 0 in new_kmalloc_cache() and remove parameter 'flags' in create_kmalloc_caches(). Also make new_kmalloc_cache() static due to it is only used in mm/slab_common.c. Signed-off-by: Zheng Yejian Acked-by: David Rientjes Reviewed-by: Chengming Zhou --- mm/slab.h | 4 +--- mm/slab_common.c | 13 +++++++------ mm/slub.c | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mm/slab.h b/mm/slab.h index 54deeb0428c6..09c673346ece 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -387,7 +387,7 @@ extern const struct kmalloc_info_struct { /* Kmalloc array related functions */ void setup_kmalloc_cache_index_table(void); -void create_kmalloc_caches(slab_flags_t); +void create_kmalloc_caches(void); extern u8 kmalloc_size_index[24]; @@ -422,8 +422,6 @@ gfp_t kmalloc_fix_flags(gfp_t flags); int __kmem_cache_create(struct kmem_cache *, slab_flags_t flags); void __init kmem_cache_init(void); -void __init new_kmalloc_cache(int idx, enum kmalloc_cache_type type, - slab_flags_t flags); extern void create_boot_cache(struct kmem_cache *, const char *name, unsigned int size, slab_flags_t flags, unsigned int useroffset, unsigned int usersize); diff --git a/mm/slab_common.c b/mm/slab_common.c index 238293b1dbe1..61530df8b35b 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -853,9 +853,10 @@ static unsigned int __kmalloc_minalign(void) return max(minalign, arch_slab_minalign()); } -void __init -new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) +static void __init +new_kmalloc_cache(int idx, enum kmalloc_cache_type type) { + slab_flags_t flags = 0; unsigned int minalign = __kmalloc_minalign(); unsigned int aligned_size = kmalloc_info[idx].size; int aligned_idx = idx; @@ -902,7 +903,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) * may already have been created because they were needed to * enable allocations for slab creation. */ -void __init create_kmalloc_caches(slab_flags_t flags) +void __init create_kmalloc_caches(void) { int i; enum kmalloc_cache_type type; @@ -913,7 +914,7 @@ void __init create_kmalloc_caches(slab_flags_t flags) for (type = KMALLOC_NORMAL; type < NR_KMALLOC_TYPES; type++) { for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { if (!kmalloc_caches[type][i]) - new_kmalloc_cache(i, type, flags); + new_kmalloc_cache(i, type); /* * Caches that are not of the two-to-the-power-of size. @@ -922,10 +923,10 @@ void __init create_kmalloc_caches(slab_flags_t flags) */ if (KMALLOC_MIN_SIZE <= 32 && i == 6 && !kmalloc_caches[type][1]) - new_kmalloc_cache(1, type, flags); + new_kmalloc_cache(1, type); if (KMALLOC_MIN_SIZE <= 64 && i == 7 && !kmalloc_caches[type][2]) - new_kmalloc_cache(2, type, flags); + new_kmalloc_cache(2, type); } } #ifdef CONFIG_RANDOM_KMALLOC_CACHES diff --git a/mm/slub.c b/mm/slub.c index 2ef88bbf56a3..4f912f5ec11c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5663,7 +5663,7 @@ void __init kmem_cache_init(void) /* Now we can use the kmem_cache to allocate kmalloc slabs */ setup_kmalloc_cache_index_table(); - create_kmalloc_caches(0); + create_kmalloc_caches(); /* Setup random freelists for each cache */ init_freelist_randomization();