[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1301485085.29074.61.camel@e102109-lin.cambridge.arm.com>
Date: Wed, 30 Mar 2011 12:38:05 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Daniel Baluta <dbaluta@...acom.com>
Cc: Maxin John <maxin.john@...il.com>,
naveen yadav <yad.naveen@...il.com>, linux-mips@...ux-mips.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: kmemleak for MIPS
On Wed, 2011-03-30 at 12:24 +0100, Daniel Baluta wrote:
> We have:
>
> > UDP hash table entries: 128 (order: 0, 4096 bytes)
> > CONFIG_BASE_SMALL=0
>
> udp_table_init looks like:
>
> if (!CONFIG_BASE_SMALL)
> table->hash = alloc_large_system_hash(name, .. &table->mask);
> /*
> * Make sure hash table has the minimum size
> */
>
> Since CONFIG_BASE_SMALL is 0, we are allocating the hash using
> alloc_large_system
> Then:
> if (CONFIG_BASE_SMALL || table->mask < UDP_HTABLE_SIZE_MIN - 1) {
> table->hash = kmalloc();
>
> table->mask is 127, and UDP_HTABLE_SIZE_MIN is 256, so we are allocating again
> table->hash without freeing already allocated memory.
Indeed (on my ARM system the reported UDP hash table entries is 512, so
I don't get the memory leak).
> We could free table->hash, before allocating the memory with kmalloc.
> I don't fully understand the condition table->mask < UDP_HTABLE_SIZE_MIN - 1.
We don't have the equivalent of free_large_system_hash(). Reordering the
'if' blocks may be better.
--
Catalin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists