Skip to content

Commit

Permalink
rwsem: Provide down_read_non_owner() and up_read_non_owner() for -RT
Browse files Browse the repository at this point in the history
The rwsem implementation on -RT allows multiple reader and there is no
owner tracking anymore.
We can provide down_read_non_owner() and up_read_non_owner() by skipping
the owner check bits which are only available in the !RT implementation.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Sebastian Andrzej Siewior authored and rostedt committed Aug 13, 2020
1 parent 0e5b278 commit 05e425a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/locking/rwsem.c
Expand Up @@ -1616,15 +1616,15 @@ void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest)
}
EXPORT_SYMBOL(_down_write_nest_lock);

#ifndef CONFIG_PREEMPT_RT
void down_read_non_owner(struct rw_semaphore *sem)
{
might_sleep();
__down_read(sem);
#ifndef CONFIG_PREEMPT_RT
__rwsem_set_reader_owned(sem, NULL);
#endif
}
EXPORT_SYMBOL(down_read_non_owner);
#endif

void down_write_nested(struct rw_semaphore *sem, int subclass)
{
Expand All @@ -1649,13 +1649,13 @@ int __sched down_write_killable_nested(struct rw_semaphore *sem, int subclass)
}
EXPORT_SYMBOL(down_write_killable_nested);

#ifndef CONFIG_PREEMPT_RT
void up_read_non_owner(struct rw_semaphore *sem)
{
#ifndef CONFIG_PREEMPT_RT
DEBUG_RWSEMS_WARN_ON(!is_rwsem_reader_owned(sem), sem);
#endif
__up_read(sem);
}
EXPORT_SYMBOL(up_read_non_owner);
#endif

#endif

0 comments on commit 05e425a

Please sign in to comment.