@@ -104,16 +104,30 @@ void for_each_tracepoint_in_module(struct module *mod,
104
104
* tracepoint_synchronize_unregister must be called between the last tracepoint
105
105
* probe unregistration and the end of module exit to make sure there is no
106
106
* caller executing a probe when it is freed.
107
+ *
108
+ * An alternative is to use the following for batch reclaim associated
109
+ * with a given tracepoint:
110
+ *
111
+ * - tracepoint_is_faultable() == false: call_rcu()
112
+ * - tracepoint_is_faultable() == true: call_rcu_tasks_trace()
107
113
*/
108
114
#ifdef CONFIG_TRACEPOINTS
109
115
static inline void tracepoint_synchronize_unregister (void )
110
116
{
111
117
synchronize_rcu_tasks_trace ();
112
118
synchronize_rcu ();
113
119
}
120
+ static inline bool tracepoint_is_faultable (struct tracepoint * tp )
121
+ {
122
+ return tp -> ext && tp -> ext -> faultable ;
123
+ }
114
124
#else
115
125
static inline void tracepoint_synchronize_unregister (void )
116
126
{ }
127
+ static inline bool tracepoint_is_faultable (struct tracepoint * tp )
128
+ {
129
+ return false;
130
+ }
117
131
#endif
118
132
119
133
#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
@@ -345,6 +359,15 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
345
359
static struct tracepoint_ext __tracepoint_ext_##_name = { \
346
360
.regfunc = _reg, \
347
361
.unregfunc = _unreg, \
362
+ .faultable = false, \
363
+ }; \
364
+ __DEFINE_TRACE_EXT(_name, &__tracepoint_ext_##_name, PARAMS(_proto), PARAMS(_args));
365
+
366
+ #define DEFINE_TRACE_SYSCALL (_name , _reg , _unreg , _proto , _args ) \
367
+ static struct tracepoint_ext __tracepoint_ext_##_name = { \
368
+ .regfunc = _reg, \
369
+ .unregfunc = _unreg, \
370
+ .faultable = true, \
348
371
}; \
349
372
__DEFINE_TRACE_EXT(_name, &__tracepoint_ext_##_name, PARAMS(_proto), PARAMS(_args));
350
373
@@ -389,6 +412,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
389
412
#define __DECLARE_TRACE_SYSCALL __DECLARE_TRACE
390
413
391
414
#define DEFINE_TRACE_FN (name , reg , unreg , proto , args )
415
+ #define DEFINE_TRACE_SYSCALL (name , reg , unreg , proto , args )
392
416
#define DEFINE_TRACE (name , proto , args )
393
417
#define EXPORT_TRACEPOINT_SYMBOL_GPL (name )
394
418
#define EXPORT_TRACEPOINT_SYMBOL (name )
0 commit comments