From: Sankar P <sankar.curiosity@gmail.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Luis R. Rodriguez" <lrodriguez@atheros.com>,
rnagarajan@novell.com, teheo@novell.com,
Pekka Enberg <penberg@cs.helsinki.fi>,
Luis Rodriguez <Luis.Rodriguez@atheros.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: Probable Bug (or configuration error) in kmemleak
Date: Tue, 22 Jun 2010 12:24:30 +0530 [thread overview]
Message-ID: <AANLkTilLUgKRQrww8N_n4kjYD38XZHxez-IfhJSHUP1W@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimjLtQJmfjW31aRMPyY9XTVCwNCfTR_JU_0apbd@mail.gmail.com>
On Fri, Jun 18, 2010 at 6:55 PM, Sankar P <sankar.curiosity@gmail.com> wrote:
> On Fri, Jun 18, 2010 at 6:30 PM, Catalin Marinas
> <catalin.marinas@arm.com> wrote:
>> On Fri, 2010-06-18 at 09:11 +0100, Sankar P wrote:
>>> On Thu, Jun 17, 2010 at 11:06 PM, Luis R. Rodriguez
>>> <lrodriguez@atheros.com> wrote:
>>> > On Thu, Jun 17, 2010 at 02:21:56AM -0700, Sankar P wrote:
>>> >> Hi,
>>> >>
>>> >> I wanted to detect memory leaks in one of my kernel modules. So I
>>> >> built Linus' tree with the following config options enabled (on top
>>> >> of make defconfig)
>>> >>
>>> >> CONFIG_DEBUG_KMEMLEAK=y
>>> >> CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=400
>>> >> CONFIG_DEBUG_KMEMLEAK_TEST=y
>>> >>
>>> >> If I boot with this kernel, debugfs is automatically mounted. But I do
>>> >> not have the file:
>>> >>
>>> >> /sys/kernel/debug/kmemleak
>>> >>
>>> >> created at all. There are other files like kprobes in the mounted
>>> >> /sys/kernel/debug directory btw. So I am not able to detect any of the
>>> >> memory leaks. Is there anything I am doing wrong or missing (or) is
>>> >> this a bug in kmemleak ?
>>> >>
>>> >> Please let me know your suggestions to fix this and get memory leaks
>>> >> reporting working. Thanks.
>>> >>
>>> >> The full .config file is also attached with this mail. Sorry for the
>>> >> attachment, I did not want to paste 5k lines in the mail. Sorry if it
>>> >> is wrong.
>>> >
>>> >
>>> > This is odd.. Do you see this message on your kernel ring buffer?
>>> >
>>> > Failed to create the debugfs kmemleak file
>>> >
>>>
>>> I dont see such an error in the dmesg output. But I got another
>>> interesting error:
>>>
>>> [ 0.000000] kmemleak: Early log buffer exceeded, please increase
>>> DEBUG_KMEMLEAK_EARLY_LOG_SIZE
>>> [ 0.000000] kmemleak: Kernel memory leak detector disabled
>>
>> You would need to increase DEBUG_KMEMLEAK_EARLY_LOG_SIZE. The default of
>> 400 seems ok for me but it may not work with some other kernel
>> configurations (that's a static array for logging memory allocations
>> before the kmemleak is fully initialised and can start tracking them).
>>
>>> But after that also, I see some other lines like:
>>>
>>> [ 0.511641] kmemleak: vmalloc(64) = f7857000
>>> [ 0.511645] kmemleak: vmalloc(64) = f785a000
>>
>> This is because you compiler the test module into the kernel
>> (DEBUG_KMEMLEAK_TEST). It's not kmemleak printing this but it's testing
>> module (which leaks memory on purpose).
>>
>>> The variable DEBUG_KMEMLEAK_EARLY_LOG_SIZE was set to 400 by default.
>>> I changed it to 4000 and then 40000 (may be should try < 32567 ?) but
>>> still I get the same error message and the file
>>> /sys/kernel/debug/kmem* is never created at all.
>>
>> This shouldn't usually happen with values greater than 2000. From your
>> kernel log, the version seems to be 2.6.32. Do you have the same
>> problems with 2.6.35-rc3?
>>
>> Your .config seems to refer to the 2.6.35-rc3 kernel - are you checking
>> the right image?
>>
>
> Ah sorry. I am testing by ssh into a remote machine. After installing
> my kernel (after increasing the DEBUG_KMEMLEAK_EARLY_LOG_SIZE), Before
> rebooting, I forgot to change the default-kernel this time. I will
> check once again and will let you know. Thank you a lot for the
> "dmesg" pointer.
>
>
Thanks for your "dmesg" pointer, I was able to solve the problem. I
found that whenever I ran "defconfig", the value of 400 for
DEBUG_KMEMLEAK_EARLY_LOG_SIZE seem to be inadequate always. So I made
a trivial patch incrementing the value to 1000. This worked fine for
my debugging. So, take the patch I will send next, if you prefer.
--
Sankar P
http://psankar.blogspot.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-06-22 6:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 9:21 Sankar P
2010-06-17 17:36 ` Luis R. Rodriguez
2010-06-18 8:11 ` Sankar P
2010-06-18 13:00 ` Catalin Marinas
2010-06-18 13:25 ` Sankar P
2010-06-22 6:54 ` Sankar P [this message]
2010-06-22 6:58 ` [PATCH] mm: kmemleak: Change kmemleak default buffer size Sankar P
2010-06-22 8:11 ` Pekka Enberg
2010-06-22 8:46 ` [PATCH] kmemleak: config-options: Default buffer size for kmemleak Sankar P
2010-06-22 11:31 ` Paul Mundt
2010-06-22 12:05 ` Catalin Marinas
2010-06-22 12:14 ` Paul Mundt
2010-06-22 12:21 ` Pekka Enberg
2010-06-22 12:35 ` Catalin Marinas
2010-06-22 12:41 ` Pekka Enberg
2010-06-22 16:55 ` [PATCH] mm: kmemleak: Change kmemleak default buffer size Luis R. Rodriguez
2010-06-24 7:31 ` Sankar P
2010-06-24 18:56 ` Luis R. Rodriguez
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=AANLkTilLUgKRQrww8N_n4kjYD38XZHxez-IfhJSHUP1W@mail.gmail.com \
--to=sankar.curiosity@gmail.com \
--cc=Luis.Rodriguez@atheros.com \
--cc=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lrodriguez@atheros.com \
--cc=penberg@cs.helsinki.fi \
--cc=rnagarajan@novell.com \
--cc=teheo@novell.com \
/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