From: Jack Wang <jinpu.wang@ionos.com>
To: linux-raid@vger.kernel.org, song@kernel.org
Cc: Florian-Ewald Mueller <florian-ewald.mueller@ionos.com>,
Yu Kuai <yukuai3@huawei.com>
Subject: [PATCH] md: add check for sleepers in md_wakeup_thread()
Date: Wed, 27 Mar 2024 12:40:22 +0100 [thread overview]
Message-ID: <20240327114022.74634-1-jinpu.wang@ionos.com> (raw)
From: Florian-Ewald Mueller <florian-ewald.mueller@ionos.com>
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>
---
drivers/md/md.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7d7b982e369c..44253faa2633 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8083,7 +8083,8 @@ void md_wakeup_thread(struct md_thread __rcu *thread)
if (t) {
pr_debug("md: waking up MD thread %s.\n", t->tsk->comm);
set_bit(THREAD_WAKEUP, &t->flags);
- wake_up(&t->wqueue);
+ if (wq_has_sleeper(&t->wqueue))
+ wake_up(&t->wqueue);
}
rcu_read_unlock();
}
--
2.34.1
next reply other threads:[~2024-03-27 11:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 11:40 Jack Wang [this message]
2024-04-10 21:36 ` [PATCH] md: add check for sleepers in md_wakeup_thread() Song Liu
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=20240327114022.74634-1-jinpu.wang@ionos.com \
--to=jinpu.wang@ionos.com \
--cc=florian-ewald.mueller@ionos.com \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=yukuai3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).