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
  • Loading branch information
fenrus75 authored and xanmod committed Oct 15, 2020
1 parent fa55f3b commit 3310f5d
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 @@ -717,6 +717,7 @@ rwsem_spin_on_owner(struct rw_semaphore *sem, unsigned long nonspinnable)
struct task_struct *new, *owner;
unsigned long flags, new_flags;
enum owner_state state;
int i = 0;

owner = rwsem_owner_flags(sem, &flags);
state = rwsem_owner_state(owner, flags, nonspinnable);
Expand Down Expand Up @@ -750,7 +751,8 @@ rwsem_spin_on_owner(struct rw_semaphore *sem, unsigned long nonspinnable)
break;
}

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

Expand Down

0 comments on commit 3310f5d

Please sign in to comment.