From: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
To: catalin.marinas@arm.com
Cc: linux-kernel@vger.kernel.org, ext-phil.2.carmody@nokia.com,
linux-omap@vger.kernel.org
Subject: Re: [RFC][PATCH 0/1] kmemleak: Fix false positive with alias
Date: Tue, 29 Jun 2010 07:44:23 +0300 (EEST) [thread overview]
Message-ID: <20100629.074423.71111160.Hiroshi.DOYU@nokia.com> (raw)
In-Reply-To: <1277736372.25271.102.camel@e102109-lin.cambridge.arm.com>
From: ext Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [RFC][PATCH 0/1] kmemleak: Fix false positive with alias
Date: Mon, 28 Jun 2010 16:46:12 +0200
> Hi,
>
> (and sorry for the delay)
>
> On Fri, 2010-06-18 at 07:04 +0100, Hiroshi DOYU wrote:
>> This is another version of "kmemleak: Fix false positive", which
>> introduces another alias tree to keep track of all alias address of
>> each objects, based on the discussion(*1)
>>
>> You can also find the previous one(*2), which uses special scan area
>> for alias addresses with a conversion function.
>>
>> Compared with both methods, it seems that the current one takes a bit
>> longer to scan as below, tested with 512 elementes of (*3).
>>
>> "kmemleak: Fix false positive with alias":
>> # time echo scan > /mnt/kmemleak
>> real 0m 8.40s
>> user 0m 0.00s
>> sys 0m 8.40s
>>
>> "kmemleak: Fix false positive with special scan":
>> # time echo scan > /mnt/kmemleak
>> real 0m 3.96s
>> user 0m 0.00s
>> sys 0m 3.96s
>
> Have you tried without your patches (just the test module but without
> aliasing the pointers)? I'm curious what's the impact of your first set
> of patches.
IIRC, not much difference against the one with the first patches. I'll
measure it again later.
>> For our case(*4) to reduce false positives for the 2nd level IOMMU
>> pagetable allocation, the previous special scan seems to be enough
>> lightweight, although there might be possiblity to improve alias
>> one and also I might misunderstand the original proposal of aliasing.
>
> The performance impact is indeed pretty high, though some parts of the
> code look over-engineered to me (the __scan_block function with a loop
> going through an array of two function pointers - I think the compiler
> cannot figure out what to inline). You could just extend the
> find_and_get_object() to search both trees under a single spinlock
> region (as locking also takes time).
Ok, a good point.
> Anyway, you still get to search two trees for any pointer so there would
> always be some performance impact. I just hoped they weren't be as bad.
> In a normal system (not test module), how many elements would the alias
> tree have?
Just in our case, it's 512 at most.
> Another approach - if we assume that there is a single alias per object
> and such aliases don't overlap, we could just move (delete + re-insert)
> the corresponding kmemleak_object in the tree to the alias position.
> This way we only keep a single tree and a single object for an allocated
> block. But in your use-case, the physical address of an object may
> actually match the virtual address of a different object, so
> lookup_object() needs to be iterative. You need two new kmemleak API
> functions, e.g. kmemleak_alias() and kmemleak_unalias(), to be called
> after allocation and before freeing a memory block.
>
> If we can't make the performance hit acceptable, we could go for the
> first approach and maybe just extend kmemleak_scan_area with a function
> pointer structure rather than adding a new one. But as I said
> previously, my main issue with your original approach is that I would
> prefer to call the kmemleak API at the point where the false positive is
> allocated rather than where the parent object was.
I'll try both and measure their impact again. Thank you for your comment.
next prev parent reply other threads:[~2010-06-29 4:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-14 7:16 [RFC][PATCH 0/2] kmemleak: Fix some false positives with special scan Hiroshi DOYU
2010-05-14 7:16 ` [PATCH 1/2] " Hiroshi DOYU
2010-05-31 16:41 ` Phil Carmody
2010-06-01 10:25 ` [PATCH v2 0/3] kmemleak: Fix false positive " Hiroshi DOYU
2010-06-02 10:01 ` Catalin Marinas
2010-06-02 11:34 ` Hiroshi DOYU
2010-06-02 12:28 ` Hiroshi DOYU
2010-06-02 14:12 ` Catalin Marinas
2010-06-03 9:54 ` Hiroshi DOYU
2010-06-18 6:04 ` [RFC][PATCH 0/1] kmemleak: Fix false positive with alias Hiroshi DOYU
2010-06-22 15:36 ` Phil Carmody
2010-06-28 14:46 ` Catalin Marinas
2010-06-29 4:44 ` Hiroshi DOYU [this message]
2010-08-10 15:49 ` Hiroshi DOYU
2010-08-27 6:12 ` Hiroshi DOYU
2010-08-30 20:30 ` Paul E. McKenney
2010-09-17 13:14 ` Catalin Marinas
2010-09-17 16:18 ` Catalin Marinas
2010-09-17 17:06 ` Hiroshi DOYU
2010-09-17 17:28 ` Phil Carmody
2010-06-18 6:04 ` [PATCH 1/1] " Hiroshi DOYU
2010-06-01 10:25 ` [PATCH v2 1/3] kmemleak: Fix false positives with special scan Hiroshi DOYU
2010-06-01 10:25 ` [PATCH v2 2/3] kmemleak: Add special scan test case Hiroshi DOYU
2010-06-01 10:25 ` [PATCH v2 3/3] omap iommu: kmemleak: Fix false positive with special scan Hiroshi DOYU
2010-05-14 7:16 ` [PATCH 2/2] kmemleak: test: Add a special scan test case Hiroshi DOYU
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=20100629.074423.71111160.Hiroshi.DOYU@nokia.com \
--to=hiroshi.doyu@nokia.com \
--cc=catalin.marinas@arm.com \
--cc=ext-phil.2.carmody@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@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
all inboxes | Powered by JetHome®