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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0903CCDB465 for ; Thu, 19 Oct 2023 12:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235455AbjJSMEw (ORCPT ); Thu, 19 Oct 2023 08:04:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235378AbjJSMEd (ORCPT ); Thu, 19 Oct 2023 08:04:33 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD2BB19A9; Thu, 19 Oct 2023 05:03:43 -0700 (PDT) Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SB5s42P5Sz15N5Z; Thu, 19 Oct 2023 20:00:56 +0800 (CST) Received: from [10.174.177.174] (10.174.177.174) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 19 Oct 2023 20:03:40 +0800 Message-ID: <4dcff9fa-af8e-52bb-536a-26a2c6fa8bbf@huawei.com> Date: Thu, 19 Oct 2023 20:03:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH 4/4] ext4: reduce unnecessary memory allocation in alloc_flex_gd() To: Jan Kara CC: , , , , , , , , Baokun Li References: <20231018114221.441526-1-libaokun1@huawei.com> <20231018114221.441526-5-libaokun1@huawei.com> <20231019115719.54wd6q6dxanaodid@quack3> Content-Language: en-US From: Baokun Li In-Reply-To: <20231019115719.54wd6q6dxanaodid@quack3> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.174] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500021.china.huawei.com (7.185.36.21) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2023/10/19 19:57, Jan Kara wrote: > On Wed 18-10-23 19:42:21, Baokun Li wrote: >> When a large flex_bg file system is resized, the number of groups to be >> added may be small, and a large amount of memory that will not be used will >> be allocated. Therefore, resize_bg can be set to the size after the number >> of new_group_data to be used is aligned upwards to the power of 2. This >> does not affect the disk layout after online resize and saves some memory. >> >> Signed-off-by: Baokun Li > Looks good, just one small comment below. Feel free to add: > > Reviewed-by: Jan Kara > > >> @@ -248,6 +250,14 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned int flexbg_size) >> else >> flex_gd->resize_bg = flexbg_size; >> >> + /* Avoid allocating new groups that will not be used. */ > Perhaps make the comment more understandable like: > /* Avoid allocating large 'groups' array if not needed */ > > Honza Thank you very much for your careful review! I'll change the comment to this more understandable one in the next version. Cheers! -- With Best Regards, Baokun Li .