blob: d84e585f80a93750c9b9eeedd3379c8ef2441b93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
From e8c09e0861753c08daac556f1dc1b4bcf6a2976a Mon Sep 17 00:00:00 2001
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(-)
diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
index c6d17aee4209..4305681710b8 100644
--- a/kernel/locking/rwsem.c
+++ b/kernel/locking/rwsem.c
@@ -749,6 +749,7 @@ rwsem_spin_on_owner(struct rw_semaphore *sem)
struct task_struct *new, *owner;
unsigned long flags, new_flags;
enum owner_state state;
+ int i = 0;
lockdep_assert_preemption_disabled();
@@ -785,7 +786,8 @@ rwsem_spin_on_owner(struct rw_semaphore *sem)
break;
}
- cpu_relax();
+ if (i++ > 1000)
+ cpu_relax();
}
return state;
--
2.43.0
|