On 6/16/20 9:25 AM, Ellis H. Wilson III wrote:
In both kernels there will be bursts of fast processing as unlink()
borrows memory, with occasional long delays while unlink() (or some other
random system call) pays off memory debt. 4.12 limited this borrowing
to thousands of refs and most of the payment to the unlink() caller;
in 5.7, there are no limits, and the debt to be paid by a random user
thread can easily be millions of refs, each of which may require a page
of IO to complete.
Are there any user-tunable settings for this in 4.12? We would be
extremely interested in bumping the outstanding refs in that version if
doing so was as simple as a sysctl, hidden mount option, or something
similar.
It appears in btrfs_should_throttle_delayed_refs in 4.12 the limit is
hard-coded to delayed refs that can be completed in 1 or 2 seconds:
2868 int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle
*trans,
2869 struct btrfs_fs_info *fs_info)
2870 {
2871 u64 num_entries =
2872
atomic_read(&trans->transaction->delayed_refs.num_entries);
2873 u64 avg_runtime;
2874 u64 val;
2875
2876 smp_mb();
2877 avg_runtime = fs_info->avg_delayed_ref_runtime;
2878 val = num_entries * avg_runtime;
2879 if (val >= NSEC_PER_SEC)
2880 return 1;
2881 if (val >= NSEC_PER_SEC / 2)
2882 return 2;
Please let me know if I'm interpreting this wrongly and there is some
sysctl/mount/fs tunable I can play with.
Thanks,
ellis