diff options
author | Peter Zijlstra <peterz@infradead.org> | 2020-12-09 17:08:45 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-12-09 17:08:45 +0100 |
commit | 2b3c99ee6389d33aff91d9e7a55465d7d1332bbd (patch) | |
tree | 9e1e5d839d80c95854007c958f2c367290bf1090 /kernel/events/internal.h | |
parent | refcount: Fix a kernel-doc markup (diff) | |
parent | rwsem: Implement down_read_interruptible (diff) | |
download | linux-2b3c99ee6389d33aff91d9e7a55465d7d1332bbd.tar.xz linux-2b3c99ee6389d33aff91d9e7a55465d7d1332bbd.zip |
Merge branch 'locking/rwsem'
Diffstat (limited to 'kernel/events/internal.h')
-rw-r--r-- | kernel/events/internal.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/kernel/events/internal.h b/kernel/events/internal.h index fcbf5616a441..228801e20788 100644 --- a/kernel/events/internal.h +++ b/kernel/events/internal.h @@ -205,16 +205,12 @@ DEFINE_OUTPUT_COPY(__output_copy_user, arch_perf_out_copy_user) static inline int get_recursion_context(int *recursion) { - int rctx; - - if (unlikely(in_nmi())) - rctx = 3; - else if (in_irq()) - rctx = 2; - else if (in_softirq()) - rctx = 1; - else - rctx = 0; + unsigned int pc = preempt_count(); + unsigned char rctx = 0; + + rctx += !!(pc & (NMI_MASK)); + rctx += !!(pc & (NMI_MASK | HARDIRQ_MASK)); + rctx += !!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)); if (recursion[rctx]) return -1; |