linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Catalin Marinas <catalin.marinas@arm.com>, Linux-MM <linux-mm@kvack.org>
Subject: kmemleak not play well with low memory situation
Date: Sun, 30 Dec 2018 00:25:01 -0500	[thread overview]
Message-ID: <0b2ecfe8-b98b-755c-5b5d-00a09a0d9e57@lca.pw> (raw)

When in low memory situation with swapping, kmemleak quickly disable itself due
to cannot allocate a kmemleak_object structure. If kmemleak could hold a bit
longer, the system will trigger OOM soon to free up the memory. This is a bit
tricky to solve because in __alloc_pages_slowpath() even though it has
GFP_NOFAIL, it would fail allocation due to no GFP_DIRECT_RECLAIM,

/* Caller is not willing to reclaim, we can't balance anything */
if (!can_direct_reclaim)
	goto nopage;

if (WARN_ON_ONCE(!can_direct_reclaim))
	goto fail;

If adding GFP_DIRECT_RECLAIM to kmemleak_alloc(), it will trigger endless
warnings in slab_pre_alloc_hook(),

might_sleep_if(gfpflags_allow_blocking(flags));

             reply	other threads:[~2018-12-30  5:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-30  5:25 Qian Cai [this message]
2019-01-02 16:08 ` [PATCH] kmemleak: survive in a low-memory situation Qian Cai
2019-01-02 16:59   ` Catalin Marinas
2019-01-02 18:06     ` [PATCH v2] " Qian Cai
2019-01-03  9:32       ` Michal Hocko
2019-01-03 16:51         ` Qian Cai
2019-01-03 17:07           ` Michal Hocko
2019-01-07 10:43             ` Catalin Marinas
2019-01-08  2:06               ` Qian Cai
2019-01-08  3:49                 ` Qian Cai

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=0b2ecfe8-b98b-755c-5b5d-00a09a0d9e57@lca.pw \
    --to=cai@lca.pw \
    --cc=catalin.marinas@arm.com \
    --cc=linux-mm@kvack.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