diff --git a/runtime/linux/stat_runtime.h b/runtime/linux/stat_runtime.h index 5e27026..9491a1c 100644 --- a/runtime/linux/stat_runtime.h +++ b/runtime/linux/stat_runtime.h @@ -48,6 +48,7 @@ static Stat _stp_stat_alloc(size_t stat_data_size) return NULL; /* Called from module_init, so user context, may sleep alloc. */ + might_sleep(); st = _stp_kmalloc_gfp (sizeof(struct _Stat), STP_ALLOC_SLEEP_FLAGS); if (st == NULL) return NULL; diff --git a/runtime/linux/stp_tracepoint.c b/runtime/linux/stp_tracepoint.c index 33fe27a..95c4e95 100644 --- a/runtime/linux/stp_tracepoint.c +++ b/runtime/linux/stp_tracepoint.c @@ -80,6 +80,7 @@ int add_probe(struct tracepoint_entry *e, void *probe, void *data) } if (found) return -EEXIST; + might_sleep(); p = _stp_kmalloc_gfp(sizeof(struct stp_tp_probe), STP_ALLOC_SLEEP_FLAGS); if (!p) @@ -153,6 +154,7 @@ struct tracepoint_entry *add_tracepoint(const char *name) * Using kmalloc here to allocate a variable length element. Could * cause some memory fragmentation if overused. */ + might_sleep(); e = _stp_kmalloc_gfp(sizeof(struct tracepoint_entry) + name_len, STP_ALLOC_SLEEP_FLAGS); if (!e) diff --git a/runtime/task_finder_vma.c b/runtime/task_finder_vma.c index f0a4db9..354d424 100644 --- a/runtime/task_finder_vma.c +++ b/runtime/task_finder_vma.c @@ -53,6 +53,7 @@ __stp_tf_vma_new_entry(void) struct __stp_tf_vma_entry *entry; size_t size = sizeof (struct __stp_tf_vma_entry); #ifdef CONFIG_UTRACE + might_sleep(); entry = (struct __stp_tf_vma_entry *) _stp_kmalloc_gfp(size, STP_ALLOC_SLEEP_FLAGS); #else @@ -78,8 +79,11 @@ static int stap_initialize_vma_map(void) { size_t size = sizeof(struct hlist_head) * __STP_TF_TABLE_SIZE; - struct hlist_head *map = (struct hlist_head *) _stp_kzalloc_gfp(size, - STP_ALLOC_SLEEP_FLAGS); + struct hlist_head *map; + + might_sleep(); + map = (struct hlist_head *) _stp_kzalloc_gfp(size, + STP_ALLOC_SLEEP_FLAGS); if (map == NULL) return -ENOMEM;