From: Qian Cai <cai@gmx.us>
To: akpm@linux-foundation.org
Cc: catalin.marinas@arm.com, mhocko@suse.com,
rppt@linux.vnet.ibm.com, aryabinin@virtuozzo.com,
glider@google.com, dvyukov@google.com,
kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Qian Cai <cai@gmx.us>
Subject: [PATCH] mm/memblock: skip kmemleak for kasan_init()
Date: Wed, 28 Nov 2018 12:40:33 -0500 [thread overview]
Message-ID: <1543426833-24378-1-git-send-email-cai@gmx.us> (raw)
Kmemleak does not play well with KASAN (tested on both HPE Apollo 70 and
Huawei TaiShan 2280 aarch64 servers).
After calling start_kernel()->setup_arch()->kasan_init(), kmemleak early
log buffer went from something like 280 to 260000 which caused kmemleak
disabled and crash dump memory reservation failed. The multitude of
kmemleak_alloc() calls is from,
for_each_memblock(memory, reg) x \
while (pgdp++, addr = next, addr != end) x \
while (pudp++, addr = next, addr != end && pud_none(READ_ONCE(*pudp))) \
while (pmdp++, addr = next, addr != end && pmd_none(READ_ONCE(*pmdp))) \
while (ptep++, addr = next, addr != end && pte_none(READ_ONCE(*ptep)))
Signed-off-by: Qian Cai <cai@gmx.us>
---
mm/memblock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/memblock.c b/mm/memblock.c
index 9a2d5ae..fd78e39 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1412,6 +1412,8 @@ static void * __init memblock_alloc_internal(
done:
ptr = phys_to_virt(alloc);
+/* Skip kmemleak for kasan_init() due to high volume. */
+#ifndef CONFIG_KASAN
/*
* The min_count is set to 0 so that bootmem allocated blocks
* are never reported as leaks. This is because many of these blocks
@@ -1419,6 +1421,7 @@ static void * __init memblock_alloc_internal(
* looked up by kmemleak.
*/
kmemleak_alloc(ptr, size, 0, 0);
+#endif
return ptr;
}
--
1.8.3.1
next reply other threads:[~2018-11-28 17:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-28 17:40 Qian Cai [this message]
2018-11-28 18:18 ` 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=1543426833-24378-1-git-send-email-cai@gmx.us \
--to=cai@gmx.us \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=catalin.marinas@arm.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rppt@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox