Skip to content

Commit 3821bba

Browse files
fmueller-ionosliu-song-6
authored andcommitted
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: Florian-Ewald Mueller <florian-ewald.mueller@ionos.com> Reviewed-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Link: https://lore.kernel.org/r/20240327114022.74634-1-jinpu.wang@ionos.com Signed-off-by: Song Liu <song@kernel.org>
1 parent 151f66b commit 3821bba

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/md/md.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8087,7 +8087,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)
80878087
if (t) {
80888088
pr_debug("md: waking up MD thread %s.\n", t->tsk->comm);
80898089
set_bit(THREAD_WAKEUP, &t->flags);
8090-
wake_up(&t->wqueue);
8090+
if (wq_has_sleeper(&t->wqueue))
8091+
wake_up(&t->wqueue);
80918092
}
80928093
rcu_read_unlock();
80938094
}

0 commit comments

Comments
 (0)