diff options
author | NeilBrown <neilb@suse.com> | 2019-08-20 10:21:09 +1000 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2019-08-27 12:36:36 -0700 |
commit | 480523feae581ab714ba6610388a3b4619a2f695 (patch) | |
tree | 6d9a364a68f5a7ae8c19a76b58080161d2bbd48d /security | |
parent | 97b27821b4854ca744946dae32a3f2fd55bcd5bc (diff) |
md: only call set_in_sync() when it is expected to succeed.
Since commit 4ad23a976413 ("MD: use per-cpu counter for
writes_pending"), set_in_sync() is substantially more expensive: it
can wait for a full RCU grace period which can be 10s of milliseconds.
So we should only call it when the cost is justified.
md_check_recovery() currently calls set_in_sync() every time it finds
anything to do (on non-external active arrays). For an array
performing resync or recovery, this will be quite often.
Each call will introduce a delay to the md thread, which can noticeable
affect IO submission latency.
In md_check_recovery() we only need to call set_in_sync() if
'safemode' was non-zero at entry, meaning that there has been not
recent IO. So we save this "safemode was nonzero" state, and only
call set_in_sync() if it was non-zero.
This measurably reduces mean and maximum IO submission latency during
resync/recovery.
Reported-and-tested-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Fixes: 4ad23a976413 ("MD: use per-cpu counter for writes_pending")
Cc: stable@vger.kernel.org (v4.12+)
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'security')
0 files changed, 0 insertions, 0 deletions