mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
tracing/perf: Add interrupt_context_level() helper
Now that there are three different instances of doing the addition trick to the preempt_count() and NMI_MASK, HARDIRQ_MASK and SOFTIRQ_OFFSET macros, it deserves a helper function defined in the preempt.h header. Add the interrupt_context_level() helper and replace the three instances that do that logic with it. Link: https://lore.kernel.org/all/20211015142541.4badd8a9@gandalf.local.home/ Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
9b84fadc44
commit
91ebe8bcbf
4 changed files with 24 additions and 18 deletions
|
@ -136,12 +136,7 @@ enum {
|
|||
|
||||
static __always_inline int trace_get_context_bit(void)
|
||||
{
|
||||
unsigned long pc = preempt_count();
|
||||
unsigned char bit = 0;
|
||||
|
||||
bit += !!(pc & (NMI_MASK));
|
||||
bit += !!(pc & (NMI_MASK | HARDIRQ_MASK));
|
||||
bit += !!(pc & (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET));
|
||||
unsigned char bit = interrupt_context_level();
|
||||
|
||||
return TRACE_CTX_NORMAL - bit;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue