From: Robert Richter <robert.richter@amd.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
oprofile-list <oprofile-list@lists.sourceforge.net>,
Robert Richter <robert.richter@amd.com>, <stable@kernel.org>
Subject: [PATCH 1/3] oprofile: Free potentially owned tasks in case of errors
Date: Tue, 31 May 2011 18:46:44 +0200 [thread overview]
Message-ID: <1306860406-6094-2-git-send-email-robert.richter@amd.com> (raw)
In-Reply-To: <1306860406-6094-1-git-send-email-robert.richter@amd.com>
After registering the task free notifier we possibly have tasks in our
dying_tasks list. Free them after unregistering the notifier in case
of an error.
Cc: <stable@kernel.org> # .36+
Signed-off-by: Robert Richter <robert.richter@amd.com>
---
drivers/oprofile/buffer_sync.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index a3984f4..04250aa 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -141,6 +141,13 @@ static struct notifier_block module_load_nb = {
.notifier_call = module_load_notify,
};
+static void free_all_tasks(void)
+{
+ /* make sure we don't leak task structs */
+ process_task_mortuary();
+ process_task_mortuary();
+}
+
int sync_start(void)
{
int err;
@@ -174,6 +181,7 @@ out3:
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
out2:
task_handoff_unregister(&task_free_nb);
+ free_all_tasks();
out1:
free_cpumask_var(marked_cpus);
goto out;
@@ -192,10 +200,7 @@ void sync_stop(void)
mutex_unlock(&buffer_mutex);
flush_cpu_work();
- /* make sure we don't leak task structs */
- process_task_mortuary();
- process_task_mortuary();
-
+ free_all_tasks();
free_cpumask_var(marked_cpus);
}
--
1.7.5.rc3
next prev parent reply other threads:[~2011-05-31 17:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 16:46 [PATCH 0/3] oprofile fixes for 3.0 Robert Richter
2011-05-31 16:46 ` Robert Richter [this message]
2011-05-31 16:46 ` [PATCH 2/3] oprofile: Fix locking dependency in sync_start() Robert Richter
2011-05-31 16:46 ` [PATCH 3/3] oprofile, dcookies: Fix possible circular locking Robert Richter
2011-06-08 12:53 ` [GIT PULL] oprofile fixes for v3.0 Robert Richter
2011-06-08 14:06 ` Ingo Molnar
2011-06-09 7:02 ` Robert Richter
2011-06-09 7:15 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1306860406-6094-2-git-send-email-robert.richter@amd.com \
--to=robert.richter@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oprofile-list@lists.sourceforge.net \
--cc=peterz@infradead.org \
--cc=stable@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome