linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Denis Kirjanov <kda@linux-powerpc.org>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: msi: mark bitmap with kmemleak_not_leak()
Date: Mon, 14 Sep 2015 11:00:35 +0100	[thread overview]
Message-ID: <20150914100034.GD22991@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <1442223409.21802.1.camel@ellerman.id.au>

On Mon, Sep 14, 2015 at 07:36:49PM +1000, Michael Ellerman wrote:
> On Mon, 2015-09-14 at 10:15 +0100, Catalin Marinas wrote:
> > You could add some flag to struct msi_bitmap based on mem_init_done to
> > be able to reclaim some slab memory later. If the bitmap is small and
> > such allocation doesn't happen outside boot, it may not be worth the
> > effort.
>=20
> Right, I think that's the only solution, and it's not quite worth the tro=
uble
> because it's generally not freed at all, except via error paths.
>=20
> Still I think it would be better to move the kmemleak annotation into the=
 msi
> bitmap test code, or maybe a wrapper that's called by the test code.

Other kmemleak annotations throughout the kernel are usually added
immediately after the allocation place (since that's what kmemleak
reports as a leak).

> That way if someone starts calling alloc/free from a hotplug path for exa=
mple,
> kmemleak will still notice that free isn't really freeing.

Kmemleak would only notice the moment you clear the last reference to
the allocated memory block (like bmp->bitmap =3D NULL), so this patch
should work as along as "freeing" is done via msi_bitmap_free().

BTW, you can even use kmemleak_ignore(). The difference is that the
bitmap won't be scanned by kmemleak and that's fine since it doesn't
contain any pointers.

--=20
Catalin

  reply	other threads:[~2015-09-14 10:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-13 18:36 [PATCH] powerpc: msi: mark bitmap with kmemleak_not_leak() Denis Kirjanov
2015-09-14  6:04 ` Michael Ellerman
2015-09-14  9:15   ` Catalin Marinas
2015-09-14  9:36     ` Michael Ellerman
2015-09-14 10:00       ` Catalin Marinas [this message]
2015-09-14 10:42         ` Denis Kirjanov

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=20150914100034.GD22991@e104818-lin.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=kda@linux-powerpc.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).