From: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Zhaoyang Huang <huangzhaoyang@gmail.com>,
<linux-kernel@vger.kernel.org>, <xuewen.yan@unisoc.com>,
<ke.wang@unisoc.com>, <ben.dai@unisoc.com>,
<shian.wang@unisoc.com>, <linux-rt-users@vger.kernel.org>
Subject: [RFC PATCH] kernel: locking: rwsem optimization for rtlinux
Date: Wed, 11 May 2022 16:21:21 +0800 [thread overview]
Message-ID: <1652257281-11494-1-git-send-email-zhaoyang.huang@unisoc.com> (raw)
From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
With regard to rtlinux, releasing the lock to RT waiter could be helpful to
increase its responding time even if cfs writer listed at the head of the
wait_list.
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
kernel/locking/rwsem-xadd.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
index e795908..1b3f836 100644
--- a/kernel/locking/rwsem-xadd.c
+++ b/kernel/locking/rwsem-xadd.c
@@ -138,6 +138,18 @@ static void __rwsem_mark_wake(struct rw_semaphore *sem,
waiter = list_first_entry(&sem->wait_list, struct rwsem_waiter, list);
if (waiter->type == RWSEM_WAITING_FOR_WRITE) {
+ if ((waiter->task->policy != SCHED_NORMAL)
+ &&(waiter->task->policy != SCHED_BATCH))
+ ;
+ else {
+ list_for_each_entry(tmp, sem->wait_list.next, list) {
+ if ((tmp->task->policy != SCHED_NORMAL)
+ &&(tmp->task->policy != SCHED_BATCH)) {
+ wake_q_add(wake_q, tmp->task);
+ return;
+ }
+ }
+ }
if (wake_type == RWSEM_WAKE_ANY) {
/*
* Mark writer at the front of the queue for wakeup.
--
1.9.1
next reply other threads:[~2022-05-11 8:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 8:21 zhaoyang.huang [this message]
2022-05-11 9:36 ` Sebastian Andrzej Siewior
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=1652257281-11494-1-git-send-email-zhaoyang.huang@unisoc.com \
--to=zhaoyang.huang@unisoc.com \
--cc=ben.dai@unisoc.com \
--cc=bigeasy@linutronix.de \
--cc=huangzhaoyang@gmail.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=shian.wang@unisoc.com \
--cc=tglx@linutronix.de \
--cc=xuewen.yan@unisoc.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
all inboxes | Powered by JetHome®