public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Sami Liedes <sami.liedes@iki.fi>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux-foundation.org>
Subject: Re: kmemleak: Cannot insert 0xffff880007fedd28 into the object search tree (already existing)
Date: Wed, 9 May 2012 16:55:19 +0100	[thread overview]
Message-ID: <20120509155519.GL11099@arm.com> (raw)
In-Reply-To: <20120506160828.GE13332@sli.dy.fi>

On Sun, May 06, 2012 at 05:08:28PM +0100, Sami Liedes wrote:
> While trying to use kmemleak in KVM/x86-64 on mainline 3.3.4, I'm
> running into this error (whole preceding dmesg below):
> 
> [    2.251741] kmemleak: Cannot insert 0xffff880007fedd28 into the object search tree (already existing)
> ...
> [    2.252016] kmemleak: Kernel memory leak detector disabled

It looks like its caused by the percpu memory allocations. The set up
areas must be freed but I only did it for SMP systems, forgot about UP.
Please find a patch below.

> I tested this on some older kernels too; at least v2.6.37 behaves the
> same, i.e. I get the same kmemleak error, though not the lockdep
> warnings.

This happens on the kmemleak disable path which is called with the
kmemleak_lock acquired. I'll have a look and move the clean-up thread
scheduling around.

Thanks.

----------------8<---------------------------------------------

commit 631d16e6284ddecd9d261f929582244f6757b678
Author: Catalin Marinas <catalin.marinas@arm.com>
Date:   Wed May 9 16:45:46 2012 +0100

    kmemleak: Fix the kmemleak tracking of the percpu areas with !SMP
    
    Kmemleak tracks the percpu allocations via a specific API and the
    originally allocated areas must be removed from kmemleak (via
    kmemleak_free). The code was already doing this for SMP systems.
    
    Reported-by: Sami Liedes <sami.liedes@iki.fi>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Christoph Lameter <cl@linux-foundation.org>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

diff --git a/mm/percpu.c b/mm/percpu.c
index f47af91..2daf6d5 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1885,6 +1885,8 @@ void __init setup_per_cpu_areas(void)
 	fc = __alloc_bootmem(unit_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
 	if (!ai || !fc)
 		panic("Failed to allocate memory for percpu areas.");
+	/* kmemleak tracks the percpu allocations separately */
+	kmemleak_free(fc);
 
 	ai->dyn_size = unit_size;
 	ai->unit_size = unit_size;

-- 
Catalin

  reply	other threads:[~2012-05-09 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-06 16:08 kmemleak: Cannot insert 0xffff880007fedd28 into the object search tree (already existing) Sami Liedes
2012-05-09 15:55 ` Catalin Marinas [this message]
2012-05-09 17:16   ` Tejun Heo
2012-05-09 17:35     ` Catalin Marinas
2012-05-09 17:39       ` Tejun Heo

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=20120509155519.GL11099@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sami.liedes@iki.fi \
    --cc=tj@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