Message ID | 20230228114306.3328235-1-shikemeng@huaweicloud.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2791188wrd; Mon, 27 Feb 2023 19:42:44 -0800 (PST) X-Google-Smtp-Source: AK7set8+kKZW7GH09jfUw5f2GVVWWPp90KVtWcYRxG+vNPWrg4Rk3hxexRmuTtjBAVhNZof0aMbw X-Received: by 2002:a17:907:a64a:b0:88c:6345:d0e7 with SMTP id vu10-20020a170907a64a00b0088c6345d0e7mr904508ejc.36.1677555764238; Mon, 27 Feb 2023 19:42:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677555764; cv=none; d=google.com; s=arc-20160816; b=rZHMoxPaAwksvu/VMqWy9O4NQ/F15gl6sQdeBphPyPmlLtNFdydz2msUEx/o0zqc96 fqSaV4AR9x9g+sq/uw2rYd61GluW3/6BgNjXi5TIkaGhWycQnDk0GuJxbA2w+9NL30mz wrcqbSQhT9JTB1MUbPriMBrsfBsVaIFDjYjTVBOdRHBTMGG/YUqqlCzbv/X88dkdBFT5 821amBp1fxKIEfT5OG14yw0Vj0yR8cLlj5vD8jRZsButIp8EwGmr4YPuaij+r65xWv70 sIrY4rzbTzn2+QWK18yLwKHoMb7GLiGt0fmYU4p0V3lv//dJoEcfNoX4IHtaSNvmGVbz GUNA== 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 :message-id:date:subject:cc:to:from; bh=bkt5ZX+X3sM/wIdcd2fz/Hfp45wKYJnCFoJAFUTIYjg=; b=qByZYkEz4aY5GlrhtdrLLZTyWHrhiLrwIl5hA5vaUx+WbrCDvfkI9E6UqzHH7sTiMd C3bbYExBmGI48eeEDxpMYds7lNMYKXAFIyV72Gfg3+IUr0WVZ2uHgJF0uVb6BNwbm8Ab KLfZRV2mqi7ReolVUZ8x8W8gvWyN0pRUtacn8vYMMyL4eCzt7YBVkUVWi6fqQcnDYddU VLxn+Vn0ykGCt+Jd2fO9G6crV0IJpGi2t8xDh6tNCSFdZdwCtw9FIcNCbJvoWrDcloZn mpexlZxOhemmgnNKnX4L2XbM62upFf5JopKZkyj78ejitcShi6kDoMsciBqUGN3cjugs EspA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a17090699c400b008af40f0cf86si12784057ejn.22.2023.02.27.19.42.22; Mon, 27 Feb 2023 19:42:44 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230112AbjB1Dli (ORCPT <rfc822;liqunnana@gmail.com> + 99 others); Mon, 27 Feb 2023 22:41:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbjB1Dlh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 27 Feb 2023 22:41:37 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61ADF24129; Mon, 27 Feb 2023 19:41:33 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4PQjpJ1rcFz4f41Tt; Tue, 28 Feb 2023 11:41:28 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgDnjOrod_1jpDeZEQ--.58449S2; Tue, 28 Feb 2023 11:41:30 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ojaswin@linux.ibm.com, ritesh.list@gmail.com Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, shikemeng@huaweicloud.com Subject: [PATCH v2 00/20] Some bugfix and cleanup to mballoc Date: Tue, 28 Feb 2023 19:42:46 +0800 Message-Id: <20230228114306.3328235-1-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgDnjOrod_1jpDeZEQ--.58449S2 X-Coremail-Antispam: 1UD129KBjvJXoW7ZFW7CrWDKryUAFWxXryrJFb_yoW8uFykpF 43GrnxC34xXr17CFZxuw45X3Wft3y0kw1UGFy2g348ArnrAr9IqFnrKFyruFWUJFWkt3Zx ZFy2yr45Grs7Ca7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUv014x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2ocxC64kIII 0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xv wVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4 x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG 64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r 1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAq YI8I648v4I1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v2 6r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7sRi Pl1DUUUUU== X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, SPF_HELO_NONE,SPF_NONE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759044713499554899?= X-GMAIL-MSGID: =?utf-8?q?1759044713499554899?= |
Series |
Some bugfix and cleanup to mballoc
|
|
Message
Kemeng Shi
Feb. 28, 2023, 11:42 a.m. UTC
Hi, this series contain some random cleanup patches and some bugfix patches to make EXT4_MB_HINT_GOAL_ONLY work properly, protect pa->pa_free from race and so on. More details can be found in git log. Thanks! --- V2: -Add signed-off from Ritesh and Ojaswin to patch 3/20 "ext4: get correct ext4_group_info in ext4_mb_prefetch_fini" as this is a duplicate of a patch under reviewing. -Split out original patch "ext4: avoid to use preallocated blocks if EXT4_MB_HINT_GOAL_ONLY is set" which will be resend after improved. -Improve log information of patch 20. -Collect Reviewed-by from Ojaswin and Ritesh. Now only patch 3, 12 and 20 need futher review. --- Kemeng Shi (20): ext4: set goal start correctly in ext4_mb_normalize_request ext4: allow to find by goal if EXT4_MB_HINT_GOAL_ONLY is set ext4: get correct ext4_group_info in ext4_mb_prefetch_fini ext4: correct calculation of s_mb_preallocated ext4: correct start of used group pa for debug in ext4_mb_use_group_pa ext4: protect pa->pa_free in ext4_discard_allocated_blocks ext4: add missed brelse in ext4_free_blocks_simple ext4: remove unused return value of ext4_mb_try_best_found and ext4_mb_free_metadata ext4: Remove unnecessary release when memory allocation failed in ext4_mb_init_cache ext4: remove unnecessary e4b->bd_buddy_page check in ext4_mb_load_buddy_gfp ext4: remove unnecessary check in ext4_mb_new_blocks ext4: remove dead check in mb_buddy_mark_free ext4: remove ac->ac_found > sbi->s_mb_min_to_scan dead check in ext4_mb_check_limits ext4: use best found when complex scan of group finishs ext4: remove unnecessary exit_meta_group_info tag ext4: remove unnecessary count2 in ext4_free_data_in_buddy ext4: remove unnecessary goto in ext4_mb_mark_diskspace_used ext4: remove repeat assignment to ac_f_ex ext4: remove comment code ext4_discard_preallocations ext4: simplify calculation of blkoff in ext4_mb_new_blocks_simple fs/ext4/mballoc.c | 104 +++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 66 deletions(-)
Comments
Kemeng Shi <shikemeng@huaweicloud.com> writes: > Hi, this series contain some random cleanup patches and some bugfix > patches to make EXT4_MB_HINT_GOAL_ONLY work properly, protect pa->pa_free > from race and so on. More details can be found in git log. > Thanks! Hi Kemeng, Did you run any testing on these patches? Because I was very easily able to hit ext/009 causing kernel BUG_ON with default mkfs/mount options. It's always a good and recommended practice to ensure some level of testing on any of the patches we submit to community for review and call out in the cover letter on what has been tested and what is not. <Call stack> [ 208.545365] run fstests ext4/009 at 2023-02-28 21:44:06 [ 216.581660] EXT4-fs (loop7): mounted filesystem 33805b33-04c1-48c3-8de3-9c78f99a7598 with ordered data mode.. [ 216.709050] EXT4-fs (loop7): unmounting filesystem 33805b33-04c1-48c3-8de3-9c78f99a7598. [ 218.878042] EXT4-fs (loop7): mounted filesystem 8a919af6-f8f4-4ef4-949b-673ccd9ae8c7 with ordered data mode.. [ 255.517357] ------------[ cut here ]------------ [ 255.520274] kernel BUG at fs/ext4/ext4.h:3331! [ 255.522233] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN PTI [ 255.524740] CPU: 7 PID: 2567 Comm: xfs_io Not tainted 6.2.0-rc8-xfstests-00041-gb1b4634ed055 #21 [ 255.527807] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.4 [ 255.531645] RIP: 0010:ext4_get_group_info+0x272/0x2f0 [ 255.533682] Code: 0f 85 a9 fe ff ff 48 c7 c2 c0 9b 7d 84 be fd 02 00 00 48 c7 c7 c0 95 7d 84 c6 05 9e b4 3b 8 [ 255.539798] RSP: 0018:ffff8881fcd6f6b0 EFLAGS: 00010246 [ 255.541721] RAX: 0000000000000000 RBX: ffff8881bfc54000 RCX: ffffffff81ec3d1a [ 255.544181] RDX: 1ffff11040b8a208 RSI: 0000000000000050 RDI: ffff888205c51040 [ 255.546695] RBP: ffff888205c51000 R08: 0000000000000000 R09: ffff8881bfc54000 [ 255.549151] R10: ffffed102af9756b R11: ffff8881fcd6f5b4 R12: ffff8881fcd6f8a8 [ 255.551588] R13: ffff8881bfc546e8 R14: ffff888157c189b8 R15: ffff888157c189e0 [ 255.554039] FS: 00007ffff7e58840(0000) GS:ffff8883ecc00000(0000) knlGS:0000000000000000 [ 255.556788] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 255.558806] CR2: 00007ffff7a7bd58 CR3: 0000000181db4005 CR4: 0000000000170ee0 [ 255.561259] Call Trace: [ 255.562248] <TASK> [ 255.563164] ? kasan_set_track+0x25/0x30 [ 255.564710] ext4_mb_find_by_goal+0xf1/0xda0 [ 255.566317] ? ext4_alloc_file_blocks.isra.0+0x2a7/0x9a0 [ 255.568230] ? ext4_fallocate+0x28b/0x7d0 [ 255.569727] ? vfs_fallocate+0x2b0/0xb90 [ 255.571238] ? __x64_sys_fallocate+0xb9/0x110 [ 255.572852] ? do_syscall_64+0x3f/0x90 [ 255.574372] ? __pfx_ext4_mb_find_by_goal+0x10/0x10 [ 255.576131] ? set_track_prepare+0x40/0x70 [ 255.577677] ? kmem_cache_alloc+0x388/0x440 [ 255.579207] ext4_mb_regular_allocator+0x1f7/0x1970 [ 255.580981] ? entry_SYSCALL_64_after_hwframe+0x72/0xdc [ 255.582874] ? ___slab_alloc+0xc93/0xd40 [ 255.584329] ? ext4_mb_new_blocks+0xc8f/0x15c0 [ 255.585976] ? __pfx___lock_release+0x10/0x10 [ 255.587652] ? __pfx_ext4_mb_regular_allocator+0x10/0x10 [ 255.589554] ? rcu_read_lock_sched_held+0x47/0x80 [ 255.591293] ? trace_kmem_cache_alloc+0x2d/0xe0 [ 255.592997] ? kmem_cache_alloc+0x25a/0x440 [ 255.594552] ? ext4_mb_new_blocks+0xc8f/0x15c0 [ 255.596176] ext4_mb_new_blocks+0xd3b/0x15c0 [ 255.597767] ? ext4_find_extent+0x742/0xbf0 [ 255.599301] ? __pfx_ext4_mb_new_blocks+0x10/0x10 [ 255.601021] ? lock_is_held_type+0xda/0x130 [ 255.602601] ext4_ext_map_blocks+0x151a/0x2490 [ 255.604237] ? __pfx_ext4_ext_map_blocks+0x10/0x10 [ 255.605980] ? __pfx___lock_acquired+0x10/0x10 [ 255.607648] ? lock_is_held_type+0xda/0x130 [ 255.609199] ? ext4_map_blocks+0x6c9/0x1670 [ 255.610757] ? ext4_map_blocks+0x6c9/0x1670 [ 255.612289] ? lock_acquired+0x10d/0x2b0 [ 255.613759] ? rcu_read_lock_sched_held+0x47/0x80 [ 255.615467] ? ext4_es_lookup_extent+0x43e/0xa20 [ 255.617152] ext4_map_blocks+0x724/0x1670 [ 255.618655] ? lock_is_held_type+0xda/0x130 [ 255.620179] ? __pfx_ext4_map_blocks+0x10/0x10 [ 255.621813] ? rcu_read_lock_sched_held+0x47/0x80 [ 255.623512] ? jbd2__journal_start+0x4ef/0x780 [ 255.625191] ext4_alloc_file_blocks.isra.0+0x2a7/0x9a0 [ 255.627019] ? __pfx_ext4_alloc_file_blocks.isra.0+0x10/0x10 [ 255.629034] ? __pfx_file_modified_flags+0x10/0x10 [ 255.630797] ? lock_is_held_type+0xda/0x130 [ 255.632320] ext4_fallocate+0x28b/0x7d0 [ 255.633855] vfs_fallocate+0x2b0/0xb90 [ 255.635252] __x64_sys_fallocate+0xb9/0x110 [ 255.636789] do_syscall_64+0x3f/0x90 [ 255.638135] entry_SYSCALL_64_after_hwframe+0x72/0xdc -ritesh
On Tue, Feb 28, 2023 at 10:04:35PM +0530, Ritesh Harjani wrote: > Kemeng Shi <shikemeng@huaweicloud.com> writes: > > > Hi, this series contain some random cleanup patches and some bugfix > > patches to make EXT4_MB_HINT_GOAL_ONLY work properly, protect pa->pa_free > > from race and so on. More details can be found in git log. > > Thanks! > > Hi Kemeng, > > Did you run any testing on these patches? Because I was very easily able > to hit ext/009 causing kernel BUG_ON with default mkfs/mount options. > It's always a good and recommended practice to ensure some level of > testing on any of the patches we submit to community for review > and call out in the cover letter on what has been tested and what is not. Hi Kemeng, If you need help running xfstests, I maintain a test appliance which makes it very easy to run xfstests on development kernels. Please see: https://github.com/tytso/xfstests-bld/blob/master/Documentation/kvm-xfstests.md https://github.com/tytso/xfstests-bld/blob/master/Documentation/kvm-quickstart.md This test appliance can also be run on Android devices and using Google Compute Engine; for more information see: https://thunk.org/android-xfstests https://thunk.org/gce-xfstests If you're just getting started, I recommend that you start with kvm-xfstests, and this is the simplest way to get started. Cheers, - Ted
on 3/1/2023 6:30 AM, Theodore Ts'o wrote: > On Tue, Feb 28, 2023 at 10:04:35PM +0530, Ritesh Harjani wrote: >> Kemeng Shi <shikemeng@huaweicloud.com> writes: >> >>> Hi, this series contain some random cleanup patches and some bugfix >>> patches to make EXT4_MB_HINT_GOAL_ONLY work properly, protect pa->pa_free >>> from race and so on. More details can be found in git log. >>> Thanks! >> >> Hi Kemeng, >> >> Did you run any testing on these patches? Because I was very easily able >> to hit ext/009 causing kernel BUG_ON with default mkfs/mount options. >> It's always a good and recommended practice to ensure some level of >> testing on any of the patches we submit to community for review >> and call out in the cover letter on what has been tested and what is not. > > Hi Kemeng, > > If you need help running xfstests, I maintain a test appliance which > makes it very easy to run xfstests on development kernels. Please see: > > https://github.com/tytso/xfstests-bld/blob/master/Documentation/kvm-xfstests.md > https://github.com/tytso/xfstests-bld/blob/master/Documentation/kvm-quickstart.md > > This test appliance can also be run on Android devices and using > Google Compute Engine; for more information see: > > https://thunk.org/android-xfstests > https://thunk.org/gce-xfstests > > If you're just getting started, I recommend that you start with > kvm-xfstests, and this is the simplest way to get started. Hi, Theodore and Ritesh. Thanks for feedback. I will run xfstests before submitting next version. Thanks!