]> git.baikalelectronics.ru Git - kernel.git/commit
locking/lock_events: Use this_cpu_add() when necessary
authorWaiman Long <longman@redhat.com>
Fri, 24 May 2019 19:42:22 +0000 (15:42 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 24 May 2019 21:17:18 +0000 (14:17 -0700)
commit10f11456c235da52638c0919650e965f6251e67c
tree2f2d6cc2f33a22e3a0603d844396bf3f5d5b6592
parent16870cef42fa49f457410eb88ad501636ad303f1
locking/lock_events: Use this_cpu_add() when necessary

The kernel test robot has reported that the use of __this_cpu_add()
causes bug messages like:

  BUG: using __this_cpu_add() in preemptible [00000000] code: ...

Given the imprecise nature of the count and the possibility of resetting
the count and doing the measurement again, this is not really a big
problem to use the unprotected __this_cpu_*() functions.

To make the preemption checking code happy, the this_cpu_*() functions
will be used if CONFIG_DEBUG_PREEMPT is defined.

The imprecise nature of the locking counts are also documented with
the suggestion that we should run the measurement a few times with the
counts reset in between to get a better picture of what is going on
under the hood.

Fixes: 00bed050d1fc3 ("locking/rwsem: Enable lock event counting")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/locking/lock_events.h