[RFC PATCH] kernel: locking: rwsem optimization for rtlinux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux