linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Michal Hocko <mhocko@kernel.org>
Cc: akpm@linux-foundation.org, catalin.marinas@arm.com, cl@linux.com,
	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: Wed, 27 Mar 2019 09:05:31 -0400	[thread overview]
Message-ID: <68cff59d-2b0e-5a7b-bca9-36784522059b@lca.pw> (raw)
In-Reply-To: <20190327114458.GF11927@dhcp22.suse.cz>

On 3/27/19 7:44 AM, Michal Hocko wrote> What? Normal spin lock implementation
doesn't disable interrupts. So
> either I misunderstand what you are saying or you seem to be confused.
> the thing is that in_atomic relies on preempt_count to work properly and
> if you have CONFIG_PREEMPT_COUNT=n then you simply never know whether
> preemption is disabled so you do not know that a spin_lock is held.
> irqs_disabled on the other hand checks whether arch specific flag for
> IRQs handling is set (or cleared). So you would only catch irq safe spin
> locks with the above check.

Exactly, because kmemleak_alloc() is only called in a few call sites, slab
allocation, neigh_hash_alloc(), alloc_page_ext(), sg_kmalloc(),
early_amd_iommu_init() and blk_mq_alloc_rqs(), my review does not yield any of
those holding irq unsafe spinlocks.

Could future code changes suddenly call kmemleak_alloc() with a irq unsafe
spinlock held? Always possible, but it is unlikely to happen. I could put some
comments on kmemleak_alloc() about this though.


  reply	other threads:[~2019-03-27 13:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  0:59 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 [this message]
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
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=68cff59d-2b0e-5a7b-bca9-36784522059b@lca.pw \
    --to=cai@lca.pw \
    --cc=akpm@linux-foundation.org \
    --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