From: "Catalin Marinas" <catalin.marinas@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.20-rc1 00/10] Kernel memory leak detector 0.13
Date: Sun, 17 Dec 2006 23:05:08 +0000 [thread overview]
Message-ID: <b0943d9e0612171505l6dfe19c6h6391b08f41243b1@mail.gmail.com> (raw)
In-Reply-To: <20061217085859.GB2938@elte.hu>
On 17/12/06, Ingo Molnar <mingo@elte.hu> wrote:
> * Catalin Marinas <catalin.marinas@gmail.com> wrote:
> > Do you need these fixes to avoid a compiler error? If yes, this is
> > caused by a bug in gcc-4.x. The kmemleak container_of macro has
> > protection for non-constant offsets passed to container_of but the
> > faulty gcc always returns true for builtin_contant_p, even when this
> > is not the case. Previous versions (3.4) or one of the latest 4.x gcc
> > don't have this bug.
>
> correct, i needed it for gcc 4.0.2. If you want this feature upstream,
> this has to be solved - no way are we going to phase out portions of
> gcc4. It's not hard as you can see it from my patch, non-static
> container_of is very rare. We do alot of other hackery to keep older
> compilers alive, and we only drop compiler support if some important
> feature really, really needs new gcc and a sane workaround is not
> possible.
There might be a simpler solution (haven't tried it), just before your
compilation error line:
#undef container_of
#define container_of(...) __container_of(...)
I could add some meaningful macros that eliminate the use of the
non-constant offset to make this more obvious.
> > In the -rt kernel, is there any protection against a re-entrant
> > __cache_free (via cache_flusharray -> free_block -> slab_destroy) or
> > this is not needed?
>
> the problem on -rt is the per-CPU slab buffer handling. In vanilla they
> are handled with irqs off/on - but inside is an unbound algorithm so for
> -rt i converted the local_irq_disable() logic to per-CPU locks. So this
> is an -rt only problem.
>
> hm, even on vanilla you might run into problems in slab_destroy(), there
> we hold the l3 lock.
It seems that slab_destroy doesn't take the l3 lock again if it is
already held, otherwise it would fail without kmemleak. However, I
can't guarantee that even a minor change wouldn't break kmemleak.
> > There are also the memleak_object structures that need to be
> > allocated/freed. To avoid any locking dependencies, I ended up
> > delaying the memleak_object structures freeing in an RCU manner. It
> > might work if I do the same with the hash nodes.
>
> yeah, delayed RCU freeing might work better.
I could also use a simple allocator based on alloc_pages since
kmemleak doesn't track pages. It could be so simple that it would
never need to free any pages, just grow the size as required and reuse
the freed memleak objects from a list.
This would simplify the recursiveness and also work on any other slab
allocator (looking back at the amount of time I spend to sort out the
recursiveness and locking dependencies, I could've implemented a full
allocator).
I'll try to implement your other suggestions as well. Thanks.
--
Catalin
next prev parent reply other threads:[~2006-12-17 23:05 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-16 15:34 Catalin Marinas
2006-12-16 15:34 ` [PATCH 2.6.20-rc1 01/10] Base support for kmemleak Catalin Marinas
2006-12-16 15:34 ` [PATCH 2.6.20-rc1 02/10] Kmemleak documentation Catalin Marinas
2006-12-16 15:34 ` [PATCH 2.6.20-rc1 03/10] Add the memory allocation/freeing hooks for kmemleak Catalin Marinas
2006-12-16 15:34 ` [PATCH 2.6.20-rc1 04/10] Modules support " Catalin Marinas
2006-12-16 15:35 ` [PATCH 2.6.20-rc1 05/10] Add kmemleak support for i386 Catalin Marinas
2006-12-16 15:35 ` [PATCH 2.6.20-rc1 06/10] Add kmemleak support for ARM Catalin Marinas
2006-12-16 15:35 ` [PATCH 2.6.20-rc1 07/10] Remove some of the kmemleak false positives Catalin Marinas
2006-12-16 15:35 ` [PATCH 2.6.20-rc1 08/10] Keep the __init functions after initialization Catalin Marinas
2006-12-16 15:35 ` [PATCH 2.6.20-rc1 09/10] Testing module for kmemleak Catalin Marinas
2006-12-16 15:36 ` [PATCH 2.6.20-rc1 10/10] Update the MAINTAINERS file " Catalin Marinas
2006-12-16 16:57 ` [PATCH 2.6.20-rc1 00/10] Kernel memory leak detector 0.13 Ingo Molnar
2006-12-16 23:39 ` Catalin Marinas
2006-12-17 8:58 ` Ingo Molnar
2006-12-17 9:09 ` Ingo Molnar
2006-12-17 9:28 ` Ingo Molnar
2006-12-17 9:41 ` Ingo Molnar
2006-12-17 9:49 ` Ingo Molnar
2006-12-17 12:05 ` Catalin Marinas
2006-12-27 16:14 ` Catalin Marinas
2006-12-27 16:23 ` Arjan van de Ven
2006-12-27 16:30 ` Catalin Marinas
2006-12-27 16:47 ` Ingo Molnar
2006-12-27 16:56 ` Ingo Molnar
2006-12-27 17:02 ` Catalin Marinas
2006-12-17 11:58 ` Catalin Marinas
2006-12-17 13:28 ` Ingo Molnar
2006-12-17 11:09 ` Mike Galbraith
2006-12-17 23:05 ` Catalin Marinas [this message]
2006-12-18 7:29 ` Ingo Molnar
2006-12-18 10:28 ` Catalin Marinas
2006-12-18 11:21 ` Ingo Molnar
2006-12-18 12:26 ` Catalin Marinas
2006-12-18 19:56 ` Ingo Molnar
2006-12-19 9:36 ` Catalin Marinas
2006-12-27 13:52 ` Catalin Marinas
2006-12-27 15:08 ` Ingo Molnar
2006-12-27 17:30 ` Ingo Molnar
2006-12-28 0:15 ` Catalin Marinas
2006-12-28 9:44 ` Ingo Molnar
2006-12-28 11:50 ` Catalin Marinas
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=b0943d9e0612171505l6dfe19c6h6391b08f41243b1@mail.gmail.com \
--to=catalin.marinas@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®