Commit 3821bbad authored by Florian-Ewald Mueller's avatar Florian-Ewald Mueller Committed by Song Liu

md: add check for sleepers in md_wakeup_thread()

Check for sleeping thread before attempting its wake_up in
md_wakeup_thread() to avoid unnecessary spinlock contention.

With a 6.1 kernel, fio random read/write tests on many (>= 100)
virtual volumes, of 100 GiB each, on 3 md-raid5s on 8 SSDs each
(building a raid50), show by 3 to 4 % improved IOPS performance.
Signed-off-by: default avatarFlorian-Ewald Mueller <florian-ewald.mueller@ionos.com>
Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
Link: https://lore.kernel.org/r/20240327114022.74634-1-jinpu.wang@ionos.comSigned-off-by: default avatarSong Liu <song@kernel.org>
parent 151f66bb
...@@ -8087,7 +8087,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread) ...@@ -8087,7 +8087,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)
if (t) { if (t) {
pr_debug("md: waking up MD thread %s.\n", t->tsk->comm); pr_debug("md: waking up MD thread %s.\n", t->tsk->comm);
set_bit(THREAD_WAKEUP, &t->flags); set_bit(THREAD_WAKEUP, &t->flags);
wake_up(&t->wqueue); if (wq_has_sleeper(&t->wqueue))
wake_up(&t->wqueue);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment