| To: | Daniel Baluta <dbaluta@ixiacom.com> |
|---|---|
| Subject: | Re: kmemleak for MIPS |
| From: | Catalin Marinas <catalin.marinas@arm.com> |
| Date: | Wed, 30 Mar 2011 12:38:05 +0100 |
| Cc: | Maxin John <maxin.john@gmail.com>, naveen yadav <yad.naveen@gmail.com>, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Eric Dumazet <eric.dumazet@gmail.com> |
| In-reply-to: | <AANLkTi=vcn5jHpk0O8XS9XJ8s5k-mCnzUwu70mFTx4=g@mail.gmail.com> |
| Organization: | ARM Limited |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <9bde694e1003020554p7c8ff3c2o4ae7cb5d501d1ab9@mail.gmail.com> <AANLkTinnqtXf5DE+qxkTyZ9p9Mb8dXai6UxWP2HaHY3D@mail.gmail.com> <1300960540.32158.13.camel@e102109-lin.cambridge.arm.com> <AANLkTim139fpJsMJFLiyUYvFgGMz-Ljgd_yDrks-tqhE@mail.gmail.com> <1301395206.583.53.camel@e102109-lin.cambridge.arm.com> <AANLkTim-4v5Cbp6+wHoXjgKXoS0axk1cgQ5AHF_zot80@mail.gmail.com> <1301399454.583.66.camel@e102109-lin.cambridge.arm.com> <AANLkTin0_gT0E3=oGyfMwk+1quqonYBExeN9a3=v=Lob@mail.gmail.com> <AANLkTi=gMP6jQuQFovfsOX=7p-SSnwXoVLO_DVEpV63h@mail.gmail.com> <1301476505.29074.47.camel@e102109-lin.cambridge.arm.com> <AANLkTi=YB+nBG7BYuuU+rB9TC-BbWcJ6mVfkxq0iUype@mail.gmail.com> <AANLkTi=L0zqwQ869khH1efFUghGeJjoyTaBXs-O2icaM@mail.gmail.com> <AANLkTi=vcn5jHpk0O8XS9XJ8s5k-mCnzUwu70mFTx4=g@mail.gmail.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
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
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: kmemleak for MIPS, Daniel Baluta |
|---|---|
| Next by Date: | Re: kmemleak for MIPS, Maxin John |
| Previous by Thread: | Re: kmemleak for MIPS, Daniel Baluta |
| Next by Thread: | Re: kmemleak for MIPS, Maxin John |
| Indexes: | [Date] [Thread] [Top] [All Lists] |