From: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Lameter <cl@linux.com>,
"Liu, XinwuX" <xinwux.liu@intel.com>,
"penberg@kernel.org" <penberg@kernel.org>,
"mpm@selenic.com" <mpm@selenic.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"He, Bo" <bo.he@intel.com>, "Chen, Lin Z" <lin.z.chen@intel.com>
Subject: Re: [PATCH] slub/slab: fix kmemleak didn't work on some case
Date: Wed, 10 Jun 2015 15:45:50 +0800 [thread overview]
Message-ID: <5577EB2E.8090505@linux.intel.com> (raw)
In-Reply-To: <20150609150303.GB4808@e104818-lin.cambridge.arm.com>
On 2015/6/9 23:03, Catalin Marinas wrote:
> On Tue, Jun 09, 2015 at 09:10:45AM +0100, Zhang, Yanmin wrote:
>> On 2015/6/8 18:13, Catalin Marinas wrote:
>>> As I replied already, I don't think this is that bad, or at least not
>>> worse than what kmemleak already does (looking at all data whether it's
>>> pointer or not).
>> It depends. As for memleak, developers prefers there are false alarms instead
>> of missing some leaked memory.
> Lots of false positives aren't that nice, you spend a lot of time
> debugging them (I've been there in the early kmemleak days). Anyway,
> your use case is not about false positives vs. negatives but just false
> negatives.
>
> My point is that there is a lot of random, pointer-like data read by
> kmemleak even without this memset (e.g. thread stacks, non-pointer data
> in kmalloc'ed structures, data/bss sections). Just doing this memset may
> reduce the chance of false negatives a bit but I don't think it would be
> noticeable.
>
> If there is some serious memory leak (lots of objects), they would
> likely show up at some point. Even if it's a one-off leak, it's possible
> that it shows up after some time (e.g. the object pointing to this
> memory block is freed).
>
>>> It also doesn't solve the kmem_cache_alloc() case where
>>> the original object size is no longer available.
>> Such issue around kmem_cache_alloc() case happens only when the
>> caller doesn't initialize or use the full object, so the object keeps
>> old dirty data.
> The kmem_cache blocks size would be aligned to a cache line, so you
> still have some extra bytes never touched by the caller.
>
>> This patch is to resolve the redundant unused space (more than object size)
>> although the full object is used by kernel.
> So this solves only the cases where the original object size is still
> known (e.g. kmalloc). It could also be solved by telling kmemleak the
> actual object size.
Your explanation is reasonable. The patch is for debug purpose.
Maintainers can make decision based on balance.
Xinwu is a new developer in kernel community. Accepting the patch
into kernel can encourage him definitely. :)
Yanmin
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Lameter <cl@linux.com>,
"Liu, XinwuX" <xinwux.liu@intel.com>,
"penberg@kernel.org" <penberg@kernel.org>,
"mpm@selenic.com" <mpm@selenic.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"He, Bo" <bo.he@intel.com>, "Chen, Lin Z" <lin.z.chen@intel.com>
Subject: Re: [PATCH] slub/slab: fix kmemleak didn't work on some case
Date: Wed, 10 Jun 2015 15:45:50 +0800 [thread overview]
Message-ID: <5577EB2E.8090505@linux.intel.com> (raw)
In-Reply-To: <20150609150303.GB4808@e104818-lin.cambridge.arm.com>
On 2015/6/9 23:03, Catalin Marinas wrote:
> On Tue, Jun 09, 2015 at 09:10:45AM +0100, Zhang, Yanmin wrote:
>> On 2015/6/8 18:13, Catalin Marinas wrote:
>>> As I replied already, I don't think this is that bad, or at least not
>>> worse than what kmemleak already does (looking at all data whether it's
>>> pointer or not).
>> It depends. As for memleak, developers prefers there are false alarms instead
>> of missing some leaked memory.
> Lots of false positives aren't that nice, you spend a lot of time
> debugging them (I've been there in the early kmemleak days). Anyway,
> your use case is not about false positives vs. negatives but just false
> negatives.
>
> My point is that there is a lot of random, pointer-like data read by
> kmemleak even without this memset (e.g. thread stacks, non-pointer data
> in kmalloc'ed structures, data/bss sections). Just doing this memset may
> reduce the chance of false negatives a bit but I don't think it would be
> noticeable.
>
> If there is some serious memory leak (lots of objects), they would
> likely show up at some point. Even if it's a one-off leak, it's possible
> that it shows up after some time (e.g. the object pointing to this
> memory block is freed).
>
>>> It also doesn't solve the kmem_cache_alloc() case where
>>> the original object size is no longer available.
>> Such issue around kmem_cache_alloc() case happens only when the
>> caller doesn't initialize or use the full object, so the object keeps
>> old dirty data.
> The kmem_cache blocks size would be aligned to a cache line, so you
> still have some extra bytes never touched by the caller.
>
>> This patch is to resolve the redundant unused space (more than object size)
>> although the full object is used by kernel.
> So this solves only the cases where the original object size is still
> known (e.g. kmalloc). It could also be solved by telling kmemleak the
> actual object size.
Your explanation is reasonable. The patch is for debug purpose.
Maintainers can make decision based on balance.
Xinwu is a new developer in kernel community. Accepting the patch
into kernel can encourage him definitely. :)
Yanmin
next prev parent reply other threads:[~2015-06-10 7:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 5:14 [PATCH] slub/slab: fix kmemleak didn't work on some case Liu, XinwuX
2015-06-08 9:38 ` Christoph Lameter
2015-06-08 9:38 ` Christoph Lameter
2015-06-08 10:13 ` Catalin Marinas
2015-06-08 10:13 ` Catalin Marinas
2015-06-09 8:10 ` Zhang, Yanmin
2015-06-09 8:10 ` Zhang, Yanmin
2015-06-09 15:03 ` Catalin Marinas
2015-06-09 15:03 ` Catalin Marinas
2015-06-10 7:45 ` Zhang, Yanmin [this message]
2015-06-10 7:45 ` Zhang, Yanmin
2015-06-10 9:48 ` Catalin Marinas
2015-06-10 9:48 ` Catalin Marinas
2015-06-11 8:18 ` Liu, XinwuX
2015-06-11 8:18 ` Liu, XinwuX
2015-06-08 10:03 ` Catalin Marinas
2015-06-08 10:03 ` 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=5577EB2E.8090505@linux.intel.com \
--to=yanmin_zhang@linux.intel.com \
--cc=bo.he@intel.com \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=lin.z.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mpm@selenic.com \
--cc=penberg@kernel.org \
--cc=xinwux.liu@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.