From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Paulo Marques <pmarques@grupopie.com>
Cc: dtor_core@ameritech.net, akpm@osdl.org,
linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH 8/8] ALSA: convert kcalloc to kzalloc
Date: Sat, 06 Aug 2005 15:37:24 +0300 [thread overview]
Message-ID: <1123331844.11074.6.camel@haji.ri.fi> (raw)
In-Reply-To: <42F38F65.402@grupopie.com>
Hi,
Dmitry Torokhov wrote:
> > Have you seen the following in include/sound/core?
> >
> > ...
> > #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
> > #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
> > #define kfree(obj) snd_hidden_kfree(obj)
On Fri, 2005-08-05 at 17:10 +0100, Paulo Marques wrote:
> Arghh... I've been bitten by this before, too.
Me too.
On Fri, 2005-08-05 at 17:10 +0100, Paulo Marques wrote:
> I really hate this "#define kmalloc" hack. It makes the code really
> unreadble, because you expect a kmalloc to be just a kmalloc...
>
> Couldn't we turn this into a generic kernel debugging option, so that it
> could be used for every kmalloc instead of just the ones from the sound
> system?
>
> If I get this right, what this code does is to track kfree's on pointers
> that were not alloc'ed with kmalloc (using a magic number) and keep
> track of all the allocations to detect leaks.
Yes, that's what it does.
On Fri, 2005-08-05 at 17:10 +0100, Paulo Marques wrote:
> We already have SLAB_DEBUG. We could add a list of allocations with a
> proc interface (or something) to give an histogram of kmalloc callers /
> number of allocations not yet freed.
>
> This way, if after stopping everything related to sound there were still
> callers like "snd_xxxx" (through kallsyms) you would know there is a
> leak there.
>
> What does CONFIG_SND_DEBUG_MEMORY provide that this more generic scheme
> does not?
I would like to make it generic too. CONFIG_SND_DEBUG_MEMORY has the
advantage of snd_memory_done() which can detect memory leaks in their
modules automatically. Therefore, to replace the ALSA magic allocator,
we would need to track which module did the allocation and add hooks to
module_exit.
Pekka
next prev parent reply other threads:[~2005-08-06 12:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-05 14:50 [PATCH 0/8] " Pekka Enberg
2005-08-05 14:50 ` [PATCH 1/8] IA64: " Pekka Enberg
2005-08-05 14:50 ` [PATCH 2/8] PPC64: " Pekka Enberg
2005-08-05 14:51 ` [PATCH 3/8] input: " Pekka Enberg
2005-08-05 14:51 ` [PATCH 4/8] USB: " Pekka Enberg
2005-08-05 14:51 ` [PATCH 5/8] PCI: " Pekka Enberg
2005-08-05 14:51 ` [PATCH 6/8] drivers: " Pekka Enberg
2005-08-05 14:51 ` [PATCH 7/8] fs: " Pekka Enberg
2005-08-05 14:52 ` [PATCH 8/8] ALSA: " Pekka Enberg
2005-08-05 15:22 ` Dmitry Torokhov
2005-08-05 16:10 ` Paulo Marques
2005-08-06 12:37 ` Pekka Enberg [this message]
2005-08-08 10:20 ` Takashi Iwai
2005-08-06 12:52 ` Pekka Enberg
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=1123331844.11074.6.camel@haji.ri.fi \
--to=penberg@cs.helsinki.fi \
--cc=akpm@osdl.org \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=pmarques@grupopie.com \
--cc=tiwai@suse.de \
/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®