From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Alex Zhuravlev <azhuravlev@whamcloud.com>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 1/2] ext4: mballoc - prefetching for bitmaps
Date: Thu, 28 May 2020 10:47:46 -0400 [thread overview]
Message-ID: <20200528144746.GE228632@mit.edu> (raw)
In-Reply-To: <262A2973-9B2D-4DBE-8752-67E91D52C632@whamcloud.com>
On Fri, May 15, 2020 at 10:07:06AM +0000, Alex Zhuravlev wrote:
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -2127,6 +2127,96 @@ static int ext4_mb_good_group(struct ext4_allocation_context *ac,
> return 0;
> }
>
> +/*
> + * each allocation context (i.e. a thread doing allocation) has own
> + * sliding prefetch window of @s_mb_prefetch size which starts at the
> + * very first goal and moves ahead of scaning.
> + * a side effect is that subsequent allocations will likely find
> + * the bitmaps in cache or at least in-flight.
> + */
> +static void
> +ext4_mb_prefetch(struct ext4_allocation_context *ac,
> + ext4_group_t start)
> +{
> + struct super_block *sb = ac->ac_sb;
> + ext4_group_t ngroups = ext4_get_groups_count(sb);
> + struct ext4_sb_info *sbi = EXT4_SB(sb);
> + struct ext4_group_info *grp;
> + ext4_group_t nr, group = start;
> + struct buffer_head *bh;
> +
> + /* limit prefetching at cr=0, otherwise mballoc can
> + * spend a lot of time loading imperfect groups */
> + if (ac->ac_criteria < 2 && ac->ac_prefetch_ios >= sbi->s_mb_prefetch_limit)
> + return;
> +
> + /* batch prefetching to get few READs in flight */
> + nr = ac->ac_prefetch - group;
> + if (ac->ac_prefetch < group)
> + /* wrapped to the first groups */
> + nr += ngroups;
> + if (nr > 0)I
> + return;
> + BUG_ON(nr < 0);
What are you trying to do here? If nr > 0, we return; if nr < 0, we
BUG() --- but nr is an unsigned int, so we never can trigger --- which
was the warning reported by the kbuild test bot. So we will only get
past this point if ac_prefetch == group. But ac_prefetch appears to
be the last group that we prefetched, so it's not clear that the logic
is correct here.
- Ted
next prev parent reply other threads:[~2020-05-28 14:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 10:07 [PATCH 1/2] ext4: mballoc - prefetching for bitmaps Alex Zhuravlev
2020-05-20 4:45 ` kbuild test robot
2020-05-20 4:45 ` kbuild test robot
2020-05-23 19:27 ` kbuild test robot
2020-05-23 19:27 ` kbuild test robot
2020-05-28 14:47 ` Theodore Y. Ts'o [this message]
2020-05-30 4:57 ` Alex Zhuravlev
2020-05-29 16:19 ` Благодаренко Артём
2020-05-30 5:01 ` Alex Zhuravlev
2020-06-19 17:16 ` Theodore Y. Ts'o
2020-06-19 18:23 ` Alex Zhuravlev
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=20200528144746.GE228632@mit.edu \
--to=tytso@mit.edu \
--cc=azhuravlev@whamcloud.com \
--cc=linux-ext4@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.