From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Vince Weaver <vincent.weaver@maine.edu>, Tejun Heo <tj@kernel.org>
Subject: [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack()
Date: Sun, 23 Mar 2014 14:20:44 -0000 [thread overview]
Message-ID: <20140323141939.911487677@linutronix.de> (raw)
In-Reply-To: <20140323141648.703530841@linutronix.de>
[-- Attachment #1: workqueue-add-destroy-delayed-work-on-stack.patch --]
[-- Type: text/plain, Size: 1954 bytes --]
If a delayed or deferrable work is on stack we need to tell debug
objects that we are destroying the timer and the work. Otherwise we
leak the tracking object.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Tejun Heo <tj@kernel.org>
---
include/linux/workqueue.h | 2 ++
kernel/workqueue.c | 7 +++++++
2 files changed, 9 insertions(+)
Index: tip/include/linux/workqueue.h
===================================================================
--- tip.orig/include/linux/workqueue.h
+++ tip/include/linux/workqueue.h
@@ -191,6 +191,7 @@ struct execute_work {
#ifdef CONFIG_DEBUG_OBJECTS_WORK
extern void __init_work(struct work_struct *work, int onstack);
extern void destroy_work_on_stack(struct work_struct *work);
+extern void destroy_delayed_work_on_stack(struct delayed_work *work);
static inline unsigned int work_static(struct work_struct *work)
{
return *work_data_bits(work) & WORK_STRUCT_STATIC;
@@ -198,6 +199,7 @@ static inline unsigned int work_static(s
#else
static inline void __init_work(struct work_struct *work, int onstack) { }
static inline void destroy_work_on_stack(struct work_struct *work) { }
+static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { }
static inline unsigned int work_static(struct work_struct *work) { return 0; }
#endif
Index: tip/kernel/workqueue.c
===================================================================
--- tip.orig/kernel/workqueue.c
+++ tip/kernel/workqueue.c
@@ -516,6 +516,13 @@ void destroy_work_on_stack(struct work_s
}
EXPORT_SYMBOL_GPL(destroy_work_on_stack);
+void destroy_delayed_work_on_stack(struct delayed_work *work)
+{
+ destroy_timer_on_stack(&work->timer);
+ debug_object_free(&work->work, &work_debug_descr);
+}
+EXPORT_SYMBOL_GPL(destroy_delayed_work_on_stack);
+
#else
static inline void debug_work_activate(struct work_struct *work) { }
static inline void debug_work_deactivate(struct work_struct *work) { }
next prev parent reply other threads:[~2014-03-23 14:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-23 14:20 [patch 0/2] workqueue: Add proper debugobjects support for delayed_work on stack Thomas Gleixner
2014-03-23 14:20 ` Thomas Gleixner [this message]
2014-03-24 12:51 ` [patch 1/2] workqueue: Provide destroy_delayed_work_on_stack() Tejun Heo
2014-03-25 16:37 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2014-03-23 14:20 ` [patch 2/2] x86: hpet: Use proper destructor for delayed work Thomas Gleixner
2014-03-25 16:37 ` [tip:timers/core] " tip-bot for Thomas Gleixner
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=20140323141939.911487677@linutronix.de \
--to=tglx@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=vincent.weaver@maine.edu \
/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
all inboxes | Powered by JetHome®