Skip to content

Commit

Permalink
locking: rwsem: spin faster
Browse files Browse the repository at this point in the history
tweak rwsem owner spinning a bit

Signed-off-by: Alexandre Frade <kernel@xanmod.org>
  • Loading branch information
fenrus75 authored and xanmod committed Jan 8, 2024
1 parent 59a51f8 commit 8c459ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/locking/rwsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -785,7 +786,8 @@ rwsem_spin_on_owner(struct rw_semaphore *sem)
break;
}

cpu_relax();
if (i++ > 1000)
cpu_relax();
}

return state;
Expand Down

0 comments on commit 8c459ef

Please sign in to comment.