2024-12-10 06:44:25 +03:00
|
|
|
From 78a04a7536d68fa0d8e7dc2955d37aa7f592fca5 Mon Sep 17 00:00:00 2001
|
2024-10-29 05:12:06 +03:00
|
|
|
From: Arjan van de Ven <arjan@linux.intel.com>
|
|
|
|
Date: Sun, 18 Feb 2018 23:35:41 +0000
|
|
|
|
Subject: [PATCH 3/4] locking: rwsem: spin faster
|
|
|
|
|
|
|
|
tweak rwsem owner spinning a bit
|
|
|
|
|
|
|
|
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
|
|
|
|
---
|
|
|
|
kernel/locking/rwsem.c | 4 +++-
|
|
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
--- a/kernel/locking/rwsem.c
|
|
|
|
+++ b/kernel/locking/rwsem.c
|
2024-12-10 06:44:25 +03:00
|
|
|
@@ -747,6 +747,7 @@ rwsem_spin_on_owner(struct rw_semaphore
|
2024-10-29 05:12:06 +03:00
|
|
|
struct task_struct *new, *owner;
|
|
|
|
unsigned long flags, new_flags;
|
|
|
|
enum owner_state state;
|
|
|
|
+ int i = 0;
|
|
|
|
|
|
|
|
lockdep_assert_preemption_disabled();
|
|
|
|
|
2024-12-10 06:44:25 +03:00
|
|
|
@@ -783,7 +784,8 @@ rwsem_spin_on_owner(struct rw_semaphore
|
2024-10-29 05:12:06 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
- cpu_relax();
|
|
|
|
+ if (i++ > 1000)
|
|
|
|
+ cpu_relax();
|
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|