From: Thomas Gleixner <tglx@linutronix.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-kernel@vger.kernel.org, jic23@kernel.org, lars@metafoo.de,
gregkh@linuxfoundation.org
Subject: Re: [RFC PATCH] debugobject: add support for kref
Date: Thu, 24 Oct 2013 16:48:41 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1310241615280.14242@ionos.tec.linutronix.de> (raw)
In-Reply-To: <1382609345-29370-1-git-send-email-bigeasy@linutronix.de>
On Thu, 24 Oct 2013, Sebastian Andrzej Siewior wrote:
>
> struct kref {
> atomic_t refcount;
> @@ -32,6 +33,9 @@ struct kref {
> static inline void kref_init(struct kref *kref)
> {
> atomic_set(&kref->refcount, 1);
> +#ifdef CONFIG_DEBUG_OBJECTS_KREF
> + debug_object_init(kref, NULL);
I rather prefer to have a debug_obj_descr handed in. It also should
activate the object, because then you can catch freeing of an active
kref as well. With state INIT the free checks are not triggering.
> /**
> @@ -70,6 +74,12 @@ static inline int kref_sub(struct kref *kref, unsigned int count,
> {
> WARN_ON(release == NULL);
>
> +#ifdef CONFIG_DEBUG_OBJECTS_KREF
> + if (!debug_object_is_tracked(kref)) {
> + debugobj_kref_splat(kref, release);
> + return 0;
Why can't you use debug_object_active_state(kref, descr, 0, 0)? All it
needs is a return value which tells you whether the object is tracked
and its state is ACTIVE.
> + }
> +#endif
> if (atomic_sub_and_test((int) count, &kref->refcount)) {
> release(kref);
> return 1;
What calls debug_object_free() for the kref? You seem to add tracking
objects without ever releasing them. Are you relying on kfree removing
the inactive object from the debugobjects tracking list?
Not really a good idea. There might be some different release function
than kfree. And it relies on DEBUG_OBJECTS_FREE being enabled.
So an explicit call to debug_objects_free() before release(kref) is
required. Otherwise your new check is going to fail even when the kref
is gone already.
Thanks,
tglx
next prev parent reply other threads:[~2013-10-24 14:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 10:09 Sebastian Andrzej Siewior
2013-10-24 14:48 ` Thomas Gleixner [this message]
2013-11-03 19:33 ` [PATCH v2] " Sebastian Andrzej Siewior
2013-11-04 16:15 ` Sebastian Andrzej Siewior
2013-12-11 6:45 ` Greg KH
2013-12-11 9:21 ` Thomas Gleixner
2013-12-11 9:30 ` Sebastian Andrzej Siewior
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=alpine.DEB.2.02.1310241615280.14242@ionos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®