All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] kernel: locking: rwsem optimization for rtlinux
@ 2022-05-11  8:21 zhaoyang.huang
  2022-05-11  9:36 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 2+ messages in thread
From: zhaoyang.huang @ 2022-05-11  8:21 UTC (permalink / raw)
  To: Thomas Gleixner, Sebastian Andrzej Siewior, Zhaoyang Huang,
	linux-kernel, xuewen.yan, ke.wang, ben.dai, shian.wang,
	linux-rt-users

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] kernel: locking: rwsem optimization for rtlinux
  2022-05-11  8:21 [RFC PATCH] kernel: locking: rwsem optimization for rtlinux zhaoyang.huang
@ 2022-05-11  9:36 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-05-11  9:36 UTC (permalink / raw)
  To: zhaoyang.huang
  Cc: Thomas Gleixner, Zhaoyang Huang, linux-kernel, xuewen.yan,
	ke.wang, ben.dai, shian.wang, linux-rt-users

On 2022-05-11 16:21:21 [+0800], zhaoyang.huang wrote:
> 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.

This does not apply to current kernel (v5.18-rc6). If you need want to
apply some thing to an older kernel, I suggest a backport and reasoning
why this backport is needed.
So first you need address the issue, that you are facing, in the current
development kernel.
Also it would be good to know if "rtlinux" is PREEMPT_RT or something
else. The latter uses a different mechanism.

> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-11  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  8:21 [RFC PATCH] kernel: locking: rwsem optimization for rtlinux zhaoyang.huang
2022-05-11  9:36 ` Sebastian Andrzej Siewior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.