Skip to content

Commit c404795

Browse files
fenrus75xdevs23
authored andcommitted
locking: rwsem: spin faster
tweak rwsem owner spinning a bit Signed-off-by: Simao Gomes Viana <[email protected]>
1 parent 9c57098 commit c404795

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

kernel/locking/rwsem.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ rwsem_spin_on_owner(struct rw_semaphore *sem, unsigned long nonspinnable)
717717
struct task_struct *new, *owner;
718718
unsigned long flags, new_flags;
719719
enum owner_state state;
720+
int i = 0;
720721

721722
owner = rwsem_owner_flags(sem, &flags);
722723
state = rwsem_owner_state(owner, flags, nonspinnable);
@@ -750,7 +751,8 @@ rwsem_spin_on_owner(struct rw_semaphore *sem, unsigned long nonspinnable)
750751
break;
751752
}
752753

753-
cpu_relax();
754+
if (i++ > 1000)
755+
cpu_relax();
754756
}
755757
rcu_read_unlock();
756758

0 commit comments

Comments
 (0)