|
|
f3378a |
commit 34e62f15da5adf06361ac66489936d0ffa1cc430
|
|
|
f3378a |
Author: Frank Ch. Eigler <fche@redhat.com>
|
|
|
f3378a |
Date: Tue Nov 10 22:13:53 2020 -0500
|
|
|
f3378a |
|
|
|
f3378a |
RHBZ1892179: handle exhausted stp_task_work structs
|
|
|
f3378a |
|
|
|
f3378a |
In utrace_report_syscall_entry and _exit, there is a possibility of
|
|
|
f3378a |
dereferencing a NULL pointer, in case __stp_utrace_alloc_task_work
|
|
|
f3378a |
exhausts UTRACE_TASK_WORK_POOL_SIZE live elements. While OOM is
|
|
|
f3378a |
still a possibility, this patch handles it more gracefully.
|
|
|
f3378a |
|
|
|
f3378a |
diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c
|
|
|
f3378a |
index 47355de..e2880f1 100644
|
|
|
f3378a |
--- a/runtime/stp_utrace.c
|
|
|
f3378a |
+++ b/runtime/stp_utrace.c
|
|
|
f3378a |
@@ -2337,11 +2337,11 @@ static void utrace_report_syscall_entry(void *cb_data __attribute__ ((unused)),
|
|
|
f3378a |
|
|
|
f3378a |
/* Defer the report_syscall_entry work so it doesn't happen in atomic context: */
|
|
|
f3378a |
work = __stp_utrace_alloc_task_work(utrace, NULL);
|
|
|
f3378a |
- __stp_utrace_save_regs(work, regs);
|
|
|
f3378a |
if (work == NULL) {
|
|
|
f3378a |
_stp_error("Unable to allocate space for task_work");
|
|
|
f3378a |
return;
|
|
|
f3378a |
}
|
|
|
f3378a |
+ __stp_utrace_save_regs(work, regs);
|
|
|
f3378a |
stp_init_task_work(work, &utrace_syscall_entry_work);
|
|
|
f3378a |
rc = stp_task_work_add(task, work);
|
|
|
f3378a |
// stp_task_work_add() returns -ESRCH if the task has already
|
|
|
f3378a |
@@ -2444,11 +2444,11 @@ static void utrace_report_syscall_exit(void *cb_data __attribute__ ((unused)),
|
|
|
f3378a |
|
|
|
f3378a |
/* Defer the report_syscall_exit work so it doesn't happen in atomic context: */
|
|
|
f3378a |
work = __stp_utrace_alloc_task_work(utrace, NULL);
|
|
|
f3378a |
- __stp_utrace_save_regs(work, regs);
|
|
|
f3378a |
if (work == NULL) {
|
|
|
f3378a |
_stp_error("Unable to allocate space for task_work");
|
|
|
f3378a |
return;
|
|
|
f3378a |
}
|
|
|
f3378a |
+ __stp_utrace_save_regs(work, regs);
|
|
|
f3378a |
stp_init_task_work(work, &utrace_syscall_exit_work);
|
|
|
f3378a |
rc = stp_task_work_add(task, work);
|
|
|
f3378a |
// stp_task_work_add() returns -ESRCH if the task has already
|
|
|
f3378a |
|
|
|
f3378a |
commit 83cb271b390a1b36abd4c3aa69f89c466e99e253
|
|
|
f3378a |
Author: Frank Ch. Eigler <fche@redhat.com>
|
|
|
f3378a |
Date: Fri Nov 13 12:36:07 2020 -0500
|
|
|
f3378a |
|
|
|
f3378a |
RHBZ1892179: double default UTRACE_TASK_WORKPOOL
|
|
|
f3378a |
|
|
|
f3378a |
Some workloads were observed to exhaust the previous limit of 288.
|
|
|
f3378a |
|
|
|
f3378a |
diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c
|
|
|
f3378a |
index 46ba489..6022267 100644
|
|
|
f3378a |
--- a/runtime/stp_utrace.c
|
|
|
f3378a |
+++ b/runtime/stp_utrace.c
|
|
|
f3378a |
@@ -141,7 +141,7 @@ struct __stp_utrace_task_work { /* NB: about 216 bytes, 18 per page: */
|
|
|
f3378a |
TODO: UTRACE_TASK_WORK_POOL_SIZE can be specified on the Systemtap
|
|
|
f3378a |
command line. Experiment to find the best default value. */
|
|
|
f3378a |
#ifndef UTRACE_TASK_WORK_POOL_SIZE
|
|
|
f3378a |
-#define UTRACE_TASK_WORK_POOL_SIZE 288
|
|
|
f3378a |
+#define UTRACE_TASK_WORK_POOL_SIZE 576
|
|
|
f3378a |
#endif
|
|
|
f3378a |
static DECLARE_BITMAP(__stp_utrace_task_work_pool_bitmap, UTRACE_TASK_WORK_POOL_SIZE);
|
|
|
f3378a |
static struct __stp_utrace_task_work __stp_utrace_task_work_pool[UTRACE_TASK_WORK_POOL_SIZE];
|