From: Pekka Enberg <penberg@iki.fi>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Qian Cai <cai@lca.pw>,
akpm@linux-foundation.org, cl@linux.com, mhocko@kernel.org,
willy@infradead.org, penberg@kernel.org, rientjes@google.com,
iamjoonsoo.kim@lge.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] kmemleak: survive in a low-memory situation
Date: Thu, 28 Mar 2019 13:50:29 +0200 [thread overview]
Message-ID: <8e88b618-e774-de81-ca99-a8ee89f60b5a@iki.fi> (raw)
In-Reply-To: <20190328103020.GA10283@arrakis.emea.arm.com>
Hi Catalin,
On 27/03/2019 2.59, Qian Cai wrote:
>>> Unless there is a brave soul to reimplement the kmemleak to embed it's
>>> metadata into the tracked memory itself in a foreseeable future, this
>>> provides a good balance between enabling kmemleak in a low-memory
>>> situation and not introducing too much hackiness into the existing
>>> code for now.
On Thu, Mar 28, 2019 at 08:05:31AM +0200, Pekka Enberg wrote:
>> Unfortunately I am not that brave soul, but I'm wondering what the
>> complication here is? It shouldn't be too hard to teach calculate_sizes() in
>> SLUB about a new SLAB_KMEMLEAK flag that reserves spaces for the metadata.
On 28/03/2019 12.30, Catalin Marinas wrote:> I don't think it's the
calculate_sizes() that's the hard part. The way
> kmemleak is designed assumes that the metadata has a longer lifespan
> than the slab object it is tracking (and refcounted via
> get_object/put_object()). We'd have to replace some of the
> rcu_read_(un)lock() regions with a full kmemleak_lock together with a
> few more tweaks to allow the release of kmemleak_lock during memory
> scanning (which can take minutes; so it needs to be safe w.r.t. metadata
> freeing, currently relying on a deferred RCU freeing).
Right.
I think SLUB already supports delaying object freeing because of KASAN
(see the slab_free_freelist_hook() function) so the issue with metadata
outliving object is solvable (although will consume more memory).
I can't say I remember enough details from kmemleak to comment on the
locking complications you point out, though.
- Pekka
next prev parent reply other threads:[~2019-03-28 11:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 0:59 [PATCH v4] kmemleak: survive in a low-memory situation Qian Cai
2019-03-27 8:44 ` Michal Hocko
2019-03-27 11:34 ` Qian Cai
2019-03-27 11:44 ` Michal Hocko
2019-03-27 13:05 ` Qian Cai
2019-03-27 13:17 ` Michal Hocko
2019-03-27 17:29 ` Catalin Marinas
2019-03-27 18:02 ` Qian Cai
2019-03-28 15:05 ` Catalin Marinas
2019-03-28 15:41 ` Qian Cai
2019-03-27 18:17 ` Michal Hocko
2019-03-27 18:21 ` Matthew Wilcox
2019-03-28 14:59 ` Catalin Marinas
2019-03-28 15:24 ` Qian Cai
2019-03-29 12:02 ` Michal Hocko
2019-03-29 16:16 ` Catalin Marinas
2019-04-01 20:12 ` Michal Hocko
2019-04-05 16:43 ` Catalin Marinas
2019-03-28 6:05 ` Pekka Enberg
2019-03-28 10:30 ` Catalin Marinas
2019-03-28 11:50 ` Pekka Enberg [this message]
2019-03-28 15:28 ` 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=8e88b618-e774-de81-ca99-a8ee89f60b5a@iki.fi \
--to=penberg@iki.fi \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).