From: Andreas Dilger <adilger@dilger.ca>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
Alex Zhuravlev <bzzz@whamcloud.com>
Subject: Re: [PATCH 2/4] ext4: skip non-loaded groups at cr=0/1 when scanning for good groups
Date: Tue, 21 Jul 2020 01:48:07 -0600 [thread overview]
Message-ID: <E73B0C31-4CEC-4C0E-AFD2-48159FA7DE62@dilger.ca> (raw)
In-Reply-To: <20200717155352.1053040-3-tytso@mit.edu>
[-- Attachment #1: Type: text/plain, Size: 2515 bytes --]
> On Jul 17, 2020, at 9:53 AM, Theodore Ts'o <tytso@mit.edu> wrote:
>
> From: Alex Zhuravlev <azhuravlev@whamcloud.com>
>
> cr=0 is supposed to be an optimization to save CPU cycles, but if
> buddy data (in memory) is not initialized then all this makes no sense
> as we have to do sync IO taking a lot of cycles. also, at cr=0
> mballoc doesn't store any avaibale chunk. cr=1 also skips groups using
(typo) "available", but "doesn't store any available chunk" is still
a bit confusing. Maybe "doesn't *choose* any available chunk"?
> heuristic based on avg. fragment size. it's more useful to skip such
> groups and switch to cr=2 where groups will be scanned for available
> chunks.
>
> using sparse image and dm-slow virtual device of 120TB was
> simulated. then the image was formatted and filled using debugfs to
> mark ~85% of available space as busy. mount process w/o the patch
> couldn't complete in half an hour (according to vmstat it would take
> ~10-11 hours). With the patch applied mount took ~20 seconds.
>
> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-12988
> Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
> Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Purely cosmetic fix below, but still fine otherwise.
> ---
> fs/ext4/mballoc.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 8a1e6e03c088..172994349bf6 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -2195,7 +2195,18 @@ static int ext4_mb_good_group_nolock(struct ext4_allocation_context *ac,
>
> /* We only do this if the grp has never been initialized */
> if (unlikely(EXT4_MB_GRP_NEED_INIT(grp))) {
> - ret = ext4_mb_init_group(ac->ac_sb, group, GFP_NOFS);
> + struct ext4_group_desc *gdp = ext4_get_group_desc(sb, group,
> + NULL);
> + int ret;
(style) this might be nicer to read like:
struct ext4_group_desc *gdp =
ext4_get_group_desc(sb, group, NULL);
int ret;
> + /* cr=0/1 is a very optimistic search to find large
> + * good chunks almost for free. if buddy data is
> + * not ready, then this optimization makes no sense */
> + if (cr < 2 &&
> + !(ext4_has_group_desc_csum(sb) &&
> + (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))))
> + return 0;
> + ret = ext4_mb_init_group(sb, group, GFP_NOFS);
> if (ret)
> return ret;
> }
> --
> 2.24.1
>
Cheers, Andreas
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]
next prev parent reply other threads:[~2020-07-21 7:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 15:53 [PATCH 0/4] ex4 block bitmap prefetching Theodore Ts'o
2020-07-17 15:53 ` [PATCH 1/4] ext4: add prefetching for block allocation bitmaps Theodore Ts'o
2020-07-17 21:55 ` kernel test robot
2020-07-21 7:42 ` Andreas Dilger
2020-07-23 0:36 ` Shuichi Ihara
2020-07-23 15:00 ` tytso
2020-07-17 15:53 ` [PATCH 2/4] ext4: skip non-loaded groups at cr=0/1 when scanning for good groups Theodore Ts'o
2020-07-21 7:48 ` Andreas Dilger [this message]
2020-07-24 11:27 ` Благодаренко Артём
2020-07-17 15:53 ` [PATCH 3/4] ext4: indicate via a block bitmap read is prefetched via a tracepoint Theodore Ts'o
2020-07-21 7:51 ` Andreas Dilger
2020-07-24 12:04 ` Благодаренко Артём
2020-07-17 15:53 ` [PATCH 4/4] ext4: add prefetch_block_bitmaps mount options Theodore Ts'o
2020-07-21 8:20 ` Andreas Dilger
2020-07-24 13:58 ` Благодаренко Артём
2020-07-31 19:08 [PATCH 0/4] V2- ext4 block bitmap prefetch patches Theodore Ts'o
2020-07-31 19:08 ` [PATCH 2/4] ext4: skip non-loaded groups at cr=0/1 when scanning for good groups Theodore Ts'o
2020-08-01 8:49 ` Andreas Dilger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E73B0C31-4CEC-4C0E-AFD2-48159FA7DE62@dilger.ca \
--to=adilger@dilger.ca \
--cc=bzzz@whamcloud.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).