From: Josef Bacik <josef@toxicpanda.com>
To: Nikolay Borisov <nborisov@suse.com>,
linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 5/9] btrfs: rework btrfs_calc_reclaim_metadata_size
Date: Thu, 1 Oct 2020 17:38:47 -0400 [thread overview]
Message-ID: <bef58ac4-a591-440f-89d7-143449c73ffd@toxicpanda.com> (raw)
In-Reply-To: <812450cb-e21f-83ac-27b3-803000d7b5d5@suse.com>
On 10/1/20 9:59 AM, Nikolay Borisov wrote:
>
>
> On 30.09.20 г. 23:01 ч., Josef Bacik wrote:
> <snip>
>>
>> @@ -800,6 +777,7 @@ static inline int need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
>> u64 used)
>> {
>> u64 thresh = div_factor_fine(space_info->total_bytes, 98);
>> + u64 to_reclaim, expected;
>>
>> /* If we're just plain full then async reclaim just slows us down. */
>> if ((space_info->bytes_used + space_info->bytes_reserved) >= thresh)
>> @@ -812,7 +790,25 @@ static inline int need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
>> if (space_info->reclaim_size)
>> return 0;
>>
>> - if (!btrfs_calc_reclaim_metadata_size(fs_info, space_info))
>> + to_reclaim = min_t(u64, num_online_cpus() * SZ_1M, SZ_16M);
>> + if (btrfs_can_overcommit(fs_info, space_info, to_reclaim,
>> + BTRFS_RESERVE_FLUSH_ALL))
>> + return 0;
>> +
>> + used = btrfs_space_info_used(space_info, true);
>> + if (btrfs_can_overcommit(fs_info, space_info, SZ_1M,
>> + BTRFS_RESERVE_FLUSH_ALL))
>> + expected = div_factor_fine(space_info->total_bytes, 95);
>> + else
>> + expected = div_factor_fine(space_info->total_bytes, 90);
>
> I think this should be just:
>
> expected = div_factor_fine(space_info->total_bytes, 90);
>
> Because before this check we tried to overcommit between 1 and 16m
> (depending on the online CPU's) and we failed. So there is no reason to
> think that :
>
> btrfs_can_overcommit(fs_info, space_info, SZ_1M, BTRFS_RESERVE_FLUSH_ALL)
>
> would succeed. So you can simplify the logic by eliminating the 2nd
> check for btrfs_can_overcommit
I remove all this code in a later patch, I'm just moving it here to simplify
btrfs_calc_reclaim_metadata_size, and then changing this logic later so the
changes are discrete.
>
>> +
>> + if (used > expected)
>> + to_reclaim = used - expected;
>> + else
>> + to_reclaim = 0;
>> + to_reclaim = min(to_reclaim, space_info->bytes_may_use +
>> + space_info->bytes_reserved);
>> + if (!to_reclaim)
>> return 0;
>>
>> return (used >= thresh && !btrfs_fs_closing(fs_info) &&
>>
>
> nit: Not directly related to your patch but since you are moving the
> code does it make sense to keep the fs_closing and STATE_REMOUNTING
> checks around?
>
It does because we use this as the breaking condition for the preemptive flusher
thread. Thanks,
Josef
next prev parent reply other threads:[~2020-10-01 21:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 20:01 [PATCH 0/9] Improve preemptive ENOSPC flushing Josef Bacik
2020-09-30 20:01 ` [PATCH 1/9] btrfs: add a trace point for reserve tickets Josef Bacik
2020-10-01 5:54 ` Nikolay Borisov
2020-10-01 21:33 ` Josef Bacik
2020-09-30 20:01 ` [PATCH 2/9] btrfs: improve preemptive background space flushing Josef Bacik
2020-10-01 13:19 ` Nikolay Borisov
2020-10-01 21:35 ` Josef Bacik
2020-09-30 20:01 ` [PATCH 3/9] btrfs: rename need_do_async_reclaim Josef Bacik
2020-10-01 13:20 ` Nikolay Borisov
2020-10-01 13:24 ` Nikolay Borisov
2020-10-01 21:37 ` Josef Bacik
2020-09-30 20:01 ` [PATCH 4/9] btrfs: check reclaim_size in need_preemptive_reclaim Josef Bacik
2020-10-01 13:23 ` Nikolay Borisov
2020-10-01 21:36 ` Josef Bacik
2020-09-30 20:01 ` [PATCH 5/9] btrfs: rework btrfs_calc_reclaim_metadata_size Josef Bacik
2020-10-01 13:59 ` Nikolay Borisov
2020-10-01 21:38 ` Josef Bacik [this message]
2020-09-30 20:01 ` [PATCH 6/9] btrfs: simplify the logic in need_preemptive_flushing Josef Bacik
2020-10-01 14:09 ` Nikolay Borisov
2020-10-01 21:40 ` Josef Bacik
2020-10-02 7:13 ` Nikolay Borisov
2020-09-30 20:01 ` [PATCH 7/9] btrfs: implement space clamping for preemptive flushing Josef Bacik
2020-10-01 14:49 ` Nikolay Borisov
2020-10-01 21:41 ` Josef Bacik
2020-09-30 20:01 ` [PATCH 8/9] btrfs: adjust the flush trace point to include the source Josef Bacik
2020-10-01 15:32 ` Nikolay Borisov
2020-09-30 20:01 ` [PATCH 9/9] btrfs: add a trace class for dumping the current ENOSPC state Josef Bacik
2020-10-02 8:30 ` Nikolay Borisov
2020-10-02 13:45 ` Josef Bacik
2020-10-06 12:55 ` [PATCH 0/9] Improve preemptive ENOSPC flushing Nikolay Borisov
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=bef58ac4-a591-440f-89d7-143449c73ffd@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.com \
/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.