Re: memleaks, acpi + ext4 + tty

From: Luis R. Rodriguez
Date: Fri Aug 28 2009 - 12:52:47 EST


On Fri, Aug 28, 2009 at 9:32 AM, Catalin Marinas<catalin.marinas@xxxxxxx> wrote:
> "Luis R. Rodriguez" <mcgrof@xxxxxxxxx> wrote:
>> I have an assorted collection of kmemleak reports for acpi, ext4 and
>> tty, not sure how to read these yet to fix so figure I'd at least post
>> them. To reproduce I can just dd=/dev/zero to some big file and played
>> some video.
>
> If you do a few echo scan > /sys/kernel/debug/kmemleak, do they
> disappear (i.e. transient false positives)?

Sure, I will once on rc8.

> Which kernel version is this?

v2.6.31-rc7-33172-gf4a9f9a

This is from wireless-testing, which has wireless patches on top of
rc7. John just rebased to rc8 so will give that a shot at work.

>> unreferenced object 0xffff88003e0015c0 (size 64):
>> Â comm "swapper", pid 1, jiffies 4294892352
>> Â backtrace:
>> Â Â [<ffffffff81121fad>] create_object+0x13d/0x2d0
>> Â Â [<ffffffff81122265>] kmemleak_alloc+0x25/0x60
>> Â Â [<ffffffff81118a03>] kmem_cache_alloc_node+0x193/0x200
>> Â Â [<ffffffff8152509e>] process_zones+0x70/0x1cd
>> Â Â [<ffffffff81525230>] pageset_cpuup_callback+0x35/0x92
>> Â Â [<ffffffff8152c9b7>] notifier_call_chain+0x47/0x90
>> Â Â [<ffffffff81078549>] __raw_notifier_call_chain+0x9/0x10
>> Â Â [<ffffffff81523f25>] _cpu_up+0x75/0x130
>> Â Â [<ffffffff8152403a>] cpu_up+0x5a/0x6a
>> Â Â [<ffffffff8181969e>] kernel_init+0xcc/0x1ba
>> Â Â [<ffffffff810130ca>] child_rip+0xa/0x20
>> Â Â [<ffffffffffffffff>] 0xffffffffffffffff
>
> Can't really tell. Maybe a false positive caused by kmemleak not
> scanning the pgdata node_zones. Can you post your .config file?

Sure, attached.

>> unreferenced object 0xffff88003cb5f700 (size 64):
>> Â comm "swapper", pid 1, jiffies 4294892459
>> Â backtrace:
>> Â Â [<ffffffff81121fad>] create_object+0x13d/0x2d0
>> Â Â [<ffffffff81122265>] kmemleak_alloc+0x25/0x60
>> Â Â [<ffffffff81119f3b>] __kmalloc+0x16b/0x250
>> Â Â [<ffffffff812bb549>] kzalloc+0xf/0x11
>> Â Â [<ffffffff812bbb53>] acpi_add_single_object+0x58e/0xd3c
>> Â Â [<ffffffff812bc51c>] acpi_bus_scan+0x125/0x1af
>> Â Â [<ffffffff81842361>] acpi_scan_init+0xc8/0xe9
>> Â Â [<ffffffff8184211c>] acpi_init+0x21f/0x265
>> Â Â [<ffffffff8100a05b>] do_one_initcall+0x4b/0x1b0
>> Â Â [<ffffffff81819736>] kernel_init+0x164/0x1ba
>> Â Â [<ffffffff810130ca>] child_rip+0xa/0x20
>> Â Â [<ffffffffffffffff>] 0xffffffffffffffff
>
> I get ACPI reports as well and they may be real leaks. However, I
> didn't have time to analyse the code (pretty complicated reference
> counting).

Heh OK thanks for reviewing them though.

>> unreferenced object 0xffff880039571800 (size 1024):
>> Â comm "exe", pid 1168, jiffies 4294893410
>> Â backtrace:
>> Â Â [<ffffffff81121fad>] create_object+0x13d/0x2d0
>> Â Â [<ffffffff81122265>] kmemleak_alloc+0x25/0x60
>> Â Â [<ffffffff81119f3b>] __kmalloc+0x16b/0x250
>> Â Â [<ffffffff811e1d71>] ext4_mb_init+0x1a1/0x590
>> Â Â [<ffffffff811d2da3>] ext4_fill_super+0x1df3/0x26c0
>> Â Â [<ffffffff8112774f>] get_sb_bdev+0x16f/0x1b0
>> Â Â [<ffffffff811c8fd3>] ext4_get_sb+0x13/0x20
>> Â Â [<ffffffff81127216>] vfs_kern_mount+0x76/0x180
>> Â Â [<ffffffff8112738d>] do_kern_mount+0x4d/0x130
>> Â Â [<ffffffff8113fc57>] do_mount+0x307/0x8b0
>> Â Â [<ffffffff8114028f>] sys_mount+0x8f/0xe0
>> Â Â [<ffffffff81011f02>] system_call_fastpath+0x16/0x1b
>> Â Â [<ffffffffffffffff>] 0xffffffffffffffff
>
> The ext4 reports are real leaks and patch was posted here -
> http://lkml.org/lkml/2009/7/15/62. However, it hasn't been merged into
> mainline yet (I cc'ed Aneesh).
>
> The patch is merged in my "kmemleak-fixes" branch on
> git://linux-arm.org/linux-2.6.git.

Will try to suck them out and try them.

>> unreferenced object 0xffff880006ce0400 (size 1024):
>> Â comm "mplayer", pid 5293, jiffies 4295366945
>> Â backtrace:
>> Â Â [<ffffffff81121fad>] create_object+0x13d/0x2d0
>> Â Â [<ffffffff81122265>] kmemleak_alloc+0x25/0x60
>> Â Â [<ffffffff81119f3b>] __kmalloc+0x16b/0x250
>> Â Â [<ffffffff813021b0>] tty_buffer_request_room+0xc0/0x190
>> Â Â [<ffffffff8130244c>] tty_insert_flip_string+0x3c/0xb0
>> Â Â [<ffffffff81302f49>] pty_write+0x49/0x70
>> Â Â [<ffffffff812fd3b0>] n_tty_write+0x1c0/0x450
>> Â Â [<ffffffff812f9ec1>] tty_write+0x1a1/0x290
>> Â Â [<ffffffff81124518>] vfs_write+0xb8/0x1a0
>> Â Â [<ffffffff81124fcc>] sys_write+0x4c/0x80
>> Â Â [<ffffffff81011f02>] system_call_fastpath+0x16/0x1b
>> Â Â [<ffffffffffffffff>] 0xffffffffffffffff
>
> It could be a real leak as you get several of these. I cc'ed Greg KH
> for any suggestions he may have. It looks like it only happens when
> running mplayer.

It took me a while to figure out how to reproduce, and it really
didn't make sense to see this playing video, why would playing video
affect tty?

Luis

Attachment: .config
Description: Binary data