From mboxrd@z Thu Jan 1 00:00:00 1970 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 ED9DEC47DA9 for ; Tue, 30 Jan 2024 03:50:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 812A36B00CD; Mon, 29 Jan 2024 22:50:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C4446B00CE; Mon, 29 Jan 2024 22:50:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 665876B00CF; Mon, 29 Jan 2024 22:50:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4C4676B00CD for ; Mon, 29 Jan 2024 22:50:47 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DAB9F401D1 for ; Tue, 30 Jan 2024 03:50:46 +0000 (UTC) X-FDA: 81734600892.17.858EA21 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by imf28.hostedemail.com (Postfix) with ESMTP id 3905EC0013 for ; Tue, 30 Jan 2024 03:50:44 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Du0g6FJa; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf28.hostedemail.com: domain of zhouchengming@bytedance.com designates 209.85.210.171 as permitted sender) smtp.mailfrom=zhouchengming@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706586645; 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:in-reply-to:references:references:dkim-signature; bh=AJ2f0pCFiDt+0//3KGocDBcR7ld42/5luGa3g6y5MNk=; b=MGVJAOMEH3ub5cnJmpK6Dc+22ae3bAl8e6yrTgLe4RJdY+2DxVGMqkor/6PXE1SImMTSTV HKQJOXtpNK78u7OdhqQxl4uyqiDZKVtA3IlXByYoES2MOQkZX/qAZ00yPMVi8hbew4X8Ib hrIeM7OOXLSMBMcs7qd1BckFRevBmVA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Du0g6FJa; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf28.hostedemail.com: domain of zhouchengming@bytedance.com designates 209.85.210.171 as permitted sender) smtp.mailfrom=zhouchengming@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706586645; a=rsa-sha256; cv=none; b=i0v9avjyqPV63EWTctG5J7nfWLuYZS60HLwAEs+Xf20iZ0aNXrTHkRQM8lbe0prWC0+KHq OrAXth69sNx6upoCKnH+yDFdJH/HHXqZ7lC0K/ZMwlPHBpQfTinG5IP0bMEA6vHVGK9Mr6 ilbtISrbi/iuhmRoDLaUME8s3DcvimU= Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6da202aa138so2145785b3a.2 for ; Mon, 29 Jan 2024 19:50:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1706586643; x=1707191443; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=AJ2f0pCFiDt+0//3KGocDBcR7ld42/5luGa3g6y5MNk=; b=Du0g6FJa/eyL7BrOweZSntvYPG3IM1Ap319fPwG3lS03FBZG3XRZVd8qHjY5dYgBpB k9pQeSOvYQ8HZaG15EaWcr/nnqfPFoYTgqdcNLv9WafSHhXxFGWBrSUIrN/P+a+uCYbt fe8kyglpalFJAUqQkJ1CkEqlAeJ3Xu9RnsEHseaWchWmrGvk9Ad+wvm8orIbmX1+6hjl 0SRtTmCPBhizR9m7UOu+665rBjo357lS19j5VjQ2BqsGy6dWTFs7YJt5ISIbJ0ybpGzV rkfC2WiCFXOcu437z0LklrLk3WcOGywErx3xnbJwMTDOA/zgKFY3RnT2QTep3FlfOst5 k1JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706586643; x=1707191443; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AJ2f0pCFiDt+0//3KGocDBcR7ld42/5luGa3g6y5MNk=; b=QeAO+Qu/3pCoSDqHDRd+dxeEFQMUS/uDtuo20edlRIQ3xkcPpJ9R50m0ZdGuqE4092 IvNvra5UIQNDCKutYrEHkDroNlQD3XpgklGm0lnj1DZ1ckY/z76OvP1HG0/uSQ2tx2bC 2TU4lKTiMbFsfrA1Bu1J4mxOZ6TLRJjaFMnKtpzcUNZFMZMDbNNrW1gPt4Jt2a0mzYPJ ouej80hO0jZlQLJSKdsLev3iD1RsqOdyb7ZAQFwH8UHXOuPMPq4Evo3cBpf7XevLqPs6 IrinZpcm7pWTIiwsKcbaAksb3t7s/916fLuwGXqqEfPBp0dfNqvmI30DCV7sd43elk8B Wa2w== X-Gm-Message-State: AOJu0YxYZP+RAgVxGnAS8au7lnKy119yBaFFuJJu87cP3SMPg1o+04ZK VhY8mooUTckd/6Qih6jdLulQrKwyc8JETTbY/PCV1/J5qrzr+hTS4lOURHtOJl4= X-Google-Smtp-Source: AGHT+IHjKJHaEGyCRFlWeZ2gO0sRyYBcHtiZlegxw3A2Trji9IdvmGfHUSGZ2nqA97IYlY+RdddqAg== X-Received: by 2002:a05:6a00:1d92:b0:6de:448b:1196 with SMTP id z18-20020a056a001d9200b006de448b1196mr461150pfw.16.1706586642902; Mon, 29 Jan 2024 19:50:42 -0800 (PST) Received: from [10.4.207.234] ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id ka7-20020a056a00938700b006d9a38fe569sm6581702pfb.89.2024.01.29.19.50.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Jan 2024 19:50:42 -0800 (PST) Message-ID: <4881a71a-2d40-44b7-ad13-0cf7ab62b463@bytedance.com> Date: Tue, 30 Jan 2024 11:50:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm/slub: remove parameter 'flags' in create_kmalloc_caches() Content-Language: en-US To: Zheng Yejian , cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240130014107.1262373-1-zhengyejian1@huawei.com> From: Chengming Zhou In-Reply-To: <20240130014107.1262373-1-zhengyejian1@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3905EC0013 X-Stat-Signature: iipit33axn3fjd3npfz8iw4jkjs6za9x X-Rspam-User: X-HE-Tag: 1706586644-680501 X-HE-Meta: U2FsdGVkX1+7NwL1kxbNqUzhpFROhSLUt0Nt/U8ShrmR4JjcUTCs71NDtkYtKbd69x559J+gC2aF6A7v7rtlURc44l9L8q4Ulr+Td4ZE7IVJzlnMQrGBG8qobEB2O/5gPI28kbt6D43zeHgAvJ1M3Oq188Pd28uTv+HZgbHC73xrfqdDbXobyfGrP5vAvUmEEhUPaTBLAcDXzZ37xdMfLhZE7AHNftFO1vj+4r4OGVNjuyEwzTl7jd7Ks9kxbQZGFafsOJhnSn14cBQ+aZykKvGattMR9RdX94U+KaeK5JGpDugW452/vcdFFGbeL+/c6dy/wBRJ1B3BGtpZZsNWCQ5+qCQePtpQ3ArHDdbKYeg7GVQGE2TZ4iRaDfChV8ZVrHhnTXPCxfPT5lrTNZrgMw1X6JAST0yyABQbdL/H52yFkbgJDmEarBfb5XfywF78CUh1BXuO2v08mZqWIzsw6nXyh1d9FQW+wboxB6I7/nR3cWf+6QwopGYfGgWDtI4NN9oV3V9ouOyZlsQpl5BkyJVFcOXz4455R2MitdplSrT3YbN0UaPgi9TSLGXwgAcCOJva3Lriowmm812AkRxzALnqO5bm6PgA2AYjql/z9MFy89ri5Y6+U8cLxLslkrKkUbTm+G+T+CslA0OZPcBzO3p4rEi5mJ4rrjkZU9KhJGMgatqqkrSuWO/xWymXJynjGmcCdXk+mPZwhlW3FYratgGLpuDjt/nzTjbBDQTapNn9TvQQKs8YqTPrJnDasq1nQE7qCNFyNhvSnUFGio5Zf2rRARQT8YbSFYFcthOZRfknTV8Qy4CoNfs3xoFeYO36I/Dx4kM81O3u8b6XOK8vmDMu82WEoOiyOQs/zOgn/fVQUISpf8/lvqwXQzhpBUXPnktl1nuXXG4od7lsyXIieJfwJETNTAn0/Gm6QHIFpVZWi54redQtx1IWgC8vPpwcz7130mU6Ha9Uy3bTDOC MouX3U4A yTDKUOu9qeU3LtRit4BQ17ceyr9RnbDRA4wJglBDmC9pGHaZzyipxoVOU/AZohM6SPRspB3aJ2+6Bcklu5NaChZAX3+yXEWtv9nOKPqY8dVlqnWthW5XnMNSouPUYpm+8Zq5aO3bmeBmBt112n6s5g0JUaztkrGFNSq3PC47wMnu+/JyR7TPd0gldHunWXmsj19D/uHO3GWI+w5klN1dQHYyV3DVT6NXvGqvcDEnYJhNRJpL6ZJXPiiJUbQGsyi3BJtmM 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: On 2024/1/30 09:41, Zheng Yejian wrote: > 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 Reviewed-by: Chengming Zhou Thanks. > --- > 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();