mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-27 14:04:47 -04:00
tracing/lock: Use TRACE_EVENT_FN() for contended_release
queued_spin_unlock() gates its contended_release trace call behind a static branch, so a NOP sits on the unlock path even while the tracepoint is disabled. Removing that requires replacing the unlock implementation only while contended_release is enabled, which needs a callback when the tracepoint is toggled. Convert contended_release to TRACE_EVENT_FN() and add weak no-op arch_contended_release_trace_reg()/arch_contended_release_trace_unreg() hooks. The default hooks are empty, so this is a no-op until an architecture overrides them. No functional change intended. Signed-off-by: Dmitry Ilvokhin <d@ilvokhin.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Juergen Gross <jgross@suse.com> Link: https://patch.msgid.link/1c2fcccfb584c075c02890c484f22c76a1948bf1.1785778551.git.d@ilvokhin.com
This commit is contained in:
committed by
Peter Zijlstra
parent
f7e2cb6d49
commit
b359800c69
@@ -137,7 +137,11 @@ TRACE_EVENT(contention_end,
|
||||
TP_printk("%p (ret=%d)", __entry->lock_addr, __entry->ret)
|
||||
);
|
||||
|
||||
TRACE_EVENT(contended_release,
|
||||
/* kernel/locking/mutex.c */
|
||||
int arch_contended_release_trace_reg(void);
|
||||
void arch_contended_release_trace_unreg(void);
|
||||
|
||||
TRACE_EVENT_FN(contended_release,
|
||||
|
||||
TP_PROTO(void *lock),
|
||||
|
||||
@@ -151,7 +155,9 @@ TRACE_EVENT(contended_release,
|
||||
__entry->lock_addr = lock;
|
||||
),
|
||||
|
||||
TP_printk("%p", __entry->lock_addr)
|
||||
TP_printk("%p", __entry->lock_addr),
|
||||
|
||||
arch_contended_release_trace_reg, arch_contended_release_trace_unreg
|
||||
);
|
||||
|
||||
#endif /* _TRACE_LOCK_H */
|
||||
|
||||
@@ -1272,6 +1272,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(contention_begin);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(contention_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(contended_release);
|
||||
|
||||
__weak int arch_contended_release_trace_reg(void) { return 0; }
|
||||
|
||||
__weak void arch_contended_release_trace_unreg(void) { }
|
||||
|
||||
/**
|
||||
* atomic_dec_and_mutex_lock - return holding mutex if we dec to 0
|
||||
* @cnt: the atomic which we are to dec
|
||||
|
||||
Reference in New Issue
Block a user