Please sign in to comment.
percpu_rw_semaphore: add lockdep annotations
Add lockdep annotations. Not only this can help to find the potential problems, we do not want the false warnings if, say, the task takes two different percpu_rw_semaphore's for reading. IOW, at least ->rw_sem should not use a single class. This patch exposes this internal lock to lockdep so that it represents the whole percpu_rw_semaphore. This way we do not need to add another "fake" ->lockdep_map and lock_class_key. More importantly, this also makes the output from lockdep much more understandable if it finds the problem. In short, with this patch from lockdep pov percpu_down_read() and percpu_up_read() acquire/release ->rw_sem for reading, this matches the actual semantics. This abuses __up_read() but I hope this is fine and in fact I'd like to have down_read_no_lockdep() as well, percpu_down_read_recursive_readers() will need it. Signed-off-by: Oleg Nesterov <email@example.com> Cc: Anton Arapov <firstname.lastname@example.org> Cc: Ingo Molnar <email@example.com> Cc: Linus Torvalds <firstname.lastname@example.org> Cc: Michal Marek <email@example.com> Cc: Mikulas Patocka <firstname.lastname@example.org> Cc: "Paul E. McKenney" <email@example.com> Cc: Peter Zijlstra <firstname.lastname@example.org> Cc: Srikar Dronamraju <email@example.com> Signed-off-by: Andrew Morton <firstname.lastname@example.org> Signed-off-by: Linus Torvalds <email@example.com>
- Loading branch information...
Showing with 26 additions and 5 deletions.