#endif
#undef _STP_KERNEL_PARAM_ARG
+#include <linux/workqueue.h>
+struct workqueue_struct *systemtap_wq;
static inline void stp_synchronize_sched(void)
{
- flush_scheduled_work();
+ flush_workqueue(systemtap_wq);
#if defined(STAPCONF_SYNCHRONIZE_SCHED)
synchronize_sched();
#elif defined(STAPCONF_SYNCHRONIZE_RCU)
stap, it is beneficial to add some runtime-random value to the
map hash. */
get_random_bytes(&stap_hash_seed, sizeof (stap_hash_seed));
+ systemtap_wq = alloc_workqueue("systemtap-wq",
+ WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
+ if (!systemtap_wq)
+ return !systemtap_wq;
rc = systemtap_kernel_module_init();
if (rc)
return rc;
due to tapset-procfs.cxx cleaning up after procfs probes (such
as in --monitor mode). */
systemtap_kernel_module_exit();
+ if (systemtap_wq)
+ destroy_workqueue(systemtap_wq);
}
module_exit(stap_cleanup_module);
// We will use a workqueue to schedule module_refresh work when we need
// to enable/disable probes.
- o->newline( 0) << "#include <linux/workqueue.h>";
o->newline( 0) << "static struct work_struct module_refresher_work;";
o->newline( 0) << "static void module_refresher(struct work_struct *work) {";
o->newline( 1) << "systemtap_module_refresh(NULL);";
o->newline(+1) << "if (atomic_cmpxchg(&need_module_refresh, 1, 0) == 1)";
// NB: one might like to invoke systemtap_module_refresh(NULL) directly from
// here ... however hrtimers are called from an unsleepable context, so no can do.
- o->newline(+1) << "schedule_work(&module_refresher_work);";
+ o->newline(+1) << "queue_work(systemtap_wq, &module_refresher_work);";
o->newline(-1) << "hrtimer_set_expires(timer,";
o->newline( 0) << " ktime_add(hrtimer_get_expires(timer),";
o->newline( 0) << " ktime_set(0, STP_ON_THE_FLY_INTERVAL))); ";