From 582efc99b2b8081fee3aa4cdbc42b1f67c92b279 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann?= Date: Sat, 7 May 2005 14:59:45 +0000 Subject: [PATCH] Another desparate hack to try and prevent the oops. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fri May 6 23:38:48 2005 Søren Sandmann * sysprof-module.c (do_generate): Another desparate hack to try and prevent the oops. --- ChangeLog | 5 +++++ sysprof-module.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77cf303..9a9d22f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri May 6 23:38:48 2005 Søren Sandmann + + * sysprof-module.c (do_generate): Another desparate hack to try + and prevent the oops. + Sat Apr 30 16:57:23 2005 Soeren Sandmann * process.c (PAGE_SIZE): Use getpagesize() diff --git a/sysprof-module.c b/sysprof-module.c index 17a4ac4..2497fa7 100644 --- a/sysprof-module.c +++ b/sysprof-module.c @@ -335,9 +335,17 @@ do_generate (void *data) if (head++ == &stack_traces[N_TRACES - 1]) head = &stack_traces[0]; - - wake_up (&wait_for_trace); + /* This is crack, what we actually want is "put_task_struct()", + * but that macros uses __put_task_struct() which is not exported. + * + * It does look to me like the worst that will happen is a rare + * leak, which is certainly better than an oops. + */ + if (atomic_dec_and_test(&(task)->usage)) { + free_task (task); + } + mod_timer(&timer, jiffies + INTERVAL); } @@ -348,7 +356,7 @@ on_timer(unsigned long dong) { if (current && current->state == TASK_RUNNING && current->pid != 0) { - set_current_state (TASK_UNINTERRUPTIBLE); + get_task_struct (current); INIT_WORK (&work, do_generate, current); -- 2.7.4