From: Qian Cai <cai@lca.pw>
To: Catalin Marinas <catalin.marinas@arm.com>, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@kernel.org>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v3 3/3] mm: kmemleak: Use the memory pool for early allocations
Date: Tue, 13 Aug 2019 08:35:54 -0400 [thread overview]
Message-ID: <1565699754.8572.8.camel@lca.pw> (raw)
In-Reply-To: <20190812160642.52134-4-catalin.marinas@arm.com>
On Mon, 2019-08-12 at 17:06 +0100, Catalin Marinas wrote:
> Currently kmemleak uses a static early_log buffer to trace all memory
> allocation/freeing before the slab allocator is initialised. Such early
> log is replayed during kmemleak_init() to properly initialise the
> kmemleak metadata for objects allocated up that point. With a memory
> pool that does not rely on the slab allocator, it is possible to skip
> this early log entirely.
>
> In order to remove the early logging, consider kmemleak_enabled == 1 by
> default while the kmem_cache availability is checked directly on the
> object_cache and scan_area_cache variables. The RCU callback is only
> invoked after object_cache has been initialised as we wouldn't have any
> concurrent list traversal before this.
>
> In order to reduce the number of callbacks before kmemleak is fully
> initialised, move the kmemleak_init() call to mm_init().
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
> init/main.c | 2 +-
> lib/Kconfig.debug | 11 +-
> mm/kmemleak.c | 267 +++++-----------------------------------------
> 3 files changed, 35 insertions(+), 245 deletions(-)
>
> diff --git a/init/main.c b/init/main.c
> index 96f8d5af52d6..ca05e3cd7ef7 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -556,6 +556,7 @@ static void __init mm_init(void)
> report_meminit();
> mem_init();
> kmem_cache_init();
> + kmemleak_init();
> pgtable_init();
> debug_objects_mem_init();
> vmalloc_init();
> @@ -740,7 +741,6 @@ asmlinkage __visible void __init start_kernel(void)
> initrd_start = 0;
> }
> #endif
> - kmemleak_init();
> setup_per_cpu_pageset();
> numa_policy_init();
> acpi_early_init();
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 4d39540011e2..39df06ffd9f4 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -592,17 +592,18 @@ config DEBUG_KMEMLEAK
> In order to access the kmemleak file, debugfs needs to be
> mounted (usually at /sys/kernel/debug).
>
> -config DEBUG_KMEMLEAK_EARLY_LOG_SIZE
> - int "Maximum kmemleak early log entries"
> +config DEBUG_KMEMLEAK_MEM_POOL_SIZE
> + int "Kmemleak memory pool size"
> depends on DEBUG_KMEMLEAK
> range 200 40000
> default 16000
Hmm, this seems way too small. My previous round of testing with
kmemleak.mempool=524288 works quite well on all architectures.
next prev parent reply other threads:[~2019-08-13 12:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-12 16:06 [PATCH v3 0/3] mm: kmemleak: Use a memory pool for kmemleak object allocations Catalin Marinas
2019-08-12 16:06 ` [PATCH v3 1/3] mm: kmemleak: Make the tool tolerant to struct scan_area allocation failures Catalin Marinas
[not found] ` <2ac37341-097e-17a2-fb6b-7912da9fa38e@ozlabs.ru>
2019-10-03 8:41 ` Catalin Marinas
[not found] ` <ba47fb68-f44c-04c9-7ea8-2705e799937b@ozlabs.ru>
2019-10-07 9:56 ` Catalin Marinas
2019-08-12 16:06 ` [PATCH v3 2/3] mm: kmemleak: Simple memory allocation pool for kmemleak objects Catalin Marinas
2019-08-13 9:37 ` Catalin Marinas
2019-08-12 16:06 ` [PATCH v3 3/3] mm: kmemleak: Use the memory pool for early allocations Catalin Marinas
2019-08-13 9:35 ` Catalin Marinas
2019-08-13 12:35 ` Qian Cai [this message]
2019-08-13 13:49 ` Catalin Marinas
2019-08-12 21:07 ` [PATCH v3 0/3] mm: kmemleak: Use a memory pool for kmemleak object allocations Andrew Morton
2019-08-13 9:40 ` Catalin Marinas
2019-12-03 15:51 ` Noam Stolero
2019-12-03 16:08 ` Catalin Marinas
2019-12-05 16:16 ` Noam Stolero
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=1565699754.8572.8.camel@lca.pw \
--to=cai@lca.pw \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--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).