From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@osdl.org>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
justin@expertron.co.za, linux-kernel@vger.kernel.org
Subject: Re: Tracing memory leaks (slabs) in 2.6.9+ kernels?
Date: Wed, 02 Mar 2005 20:46:23 +0100 [thread overview]
Message-ID: <4226180F.1090200@colorfullife.com> (raw)
In-Reply-To: <20050302083222.058ce1b9.akpm@osdl.org>
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
Andrew Morton wrote:
>OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> wrote:
>
>
>>Andrew Morton <akpm@osdl.org> writes:
>>
>> > + slab_bufctl(slabp)[objnr] = (unsigned long)caller;
>>
>> Umm... this patch looks strange..
>>
>> slab_bufctl() returns "kmem_bufctl_t *", but kmem_bufctl_t is
>> "unsigned short".
>>
>>
>
>Good point. This seems to work.
>
>
>
Two updates are needed for the leak detection in recent kernels:
- set kmem_bufctl_t back to unsigned long
- relax the check in check_slabuse, something like the attached patch.
Note that the patch is not tested.
--
Manfred
[-- Attachment #2: patch-recent-leak --]
[-- Type: text/plain, Size: 973 bytes --]
--- 2.6/mm/slab.c 2005-03-02 20:44:47.738737171 +0100
+++ build-2.6/mm/slab.c 2005-03-02 20:44:15.290618759 +0100
@@ -2645,18 +2642,10 @@
red1 = *dbg_redzone1(cachep, objp);
red2 = *dbg_redzone2(cachep, objp);
- /* simplest case: marked as inactive */
- if (red1 == RED_INACTIVE && red2 == RED_INACTIVE)
- continue;
-
- /* tricky case: if the bufctl value is BUFCTL_ALLOC, then
- * the object is either allocated or somewhere in a cpu
- * cache. The cpu caches are lockless and there might be
- * a concurrent alloc/free call, thus we must accept random
- * combinations of RED_ACTIVE and _INACTIVE
+ /* leak detection stores the caller address in the bufctl,
+ * thus random combinations of active and inactive are ok
*/
- if (slab_bufctl(slabp)[i] == BUFCTL_ALLOC &&
- (red1 == RED_INACTIVE || red1 == RED_ACTIVE) &&
+ if ((red1 == RED_INACTIVE || red1 == RED_ACTIVE) &&
(red2 == RED_INACTIVE || red2 == RED_ACTIVE))
continue;
next prev parent reply other threads:[~2005-03-02 20:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-02 8:17 Tracing memory leaks (slabs) in 2.6.9+ kernels? Justin Schoeman
2005-03-02 9:24 ` Andrew Morton
2005-03-02 13:32 ` OGAWA Hirofumi
2005-03-02 16:32 ` Andrew Morton
2005-03-02 19:46 ` Manfred Spraul [this message]
2005-03-03 12:19 ` Justin Schoeman
2005-03-03 12:26 ` Andrew Morton
2005-03-04 7:48 ` Justin Schoeman
2005-03-04 7:56 ` Andrew Morton
2005-03-02 9:31 ` Alexander Nyberg
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=4226180F.1090200@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=akpm@osdl.org \
--cc=hirofumi@mail.parknet.co.jp \
--cc=justin@expertron.co.za \
--cc=linux-kernel@vger.kernel.org \
/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