From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: He Zhe <zhe.he@windriver.com>
Cc: catalin.marinas@arm.com, tglx@linutronix.de, rostedt@goodmis.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2] kmemleak: Turn kmemleak_lock to raw spinlock on RT
Date: Fri, 30 Nov 2018 19:19:57 +0100 [thread overview]
Message-ID: <20181130181956.eewrlaabtceekzyu@linutronix.de> (raw)
In-Reply-To: <40a63aa5-edb6-4673-b4cc-1bc10e7b3953@windriver.com>
On 2018-11-24 22:26:46 [+0800], He Zhe wrote:
> On latest v4.19.1-rt3, both of the call traces can be reproduced with kmemleak
> enabied. And none can be reproduced with kmemleak disabled.
okay. So it needs attention.
> On latest mainline tree, none can be reproduced no matter kmemleak is enabled
> or disabled.
>
> I don't get why kfree from a preempt-disabled section should cause a warning
> without kmemleak, since kfree can't sleep.
it might. It will acquire a sleeping lock if it has go down to the
memory allocator to actually give memory back.
> If I understand correctly, the call trace above is caused by trying to schedule
> after preemption is disabled, which cannot be reached in mainline kernel. So
> we might need to turn to use raw lock to keep preemption disabled.
The buddy-allocator runs with spin locks so it is okay on !RT. So you
can use kfree() with disabled preemption or disabled interrupts.
I don't think that we want to use raw-locks in the buddy-allocator.
> >From what I reached above, this is RT-only and happens on v4.18 and v4.19.
>
> The call trace above is caused by grabbing kmemleak_lock and then getting
> scheduled and then re-grabbing kmemleak_lock. Using raw lock can also solve
> this problem.
But this is a reader / writer lock. And if I understand the other part
of the thread then it needs multiple readers.
Couldn't we just get rid of that kfree() or move it somewhere else?
I mean if the free() memory on CPU-down and allocate it again CPU-up
then we could skip that, rigth? Just allocate it and don't free it
because the CPU will likely get up again.
> Thanks,
> Zhe
Sebastian
next prev parent reply other threads:[~2018-11-30 18:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 9:04 zhe.he
2018-11-22 10:16 ` Sebastian Andrzej Siewior
2018-11-23 9:53 ` Sebastian Andrzej Siewior
2018-11-23 11:02 ` Andrea Parri
2018-11-23 11:06 ` Sebastian Andrzej Siewior
2018-11-23 11:31 ` Catalin Marinas
2018-11-23 15:51 ` Steven Rostedt
2018-11-26 8:40 ` Peter Zijlstra
2018-11-24 14:26 ` He Zhe
2018-11-30 18:19 ` Sebastian Andrzej Siewior [this message]
2018-12-05 13:53 ` He Zhe
2018-12-05 19:14 ` Sebastian Andrzej Siewior
2018-12-18 10:51 ` He Zhe
2018-12-18 15:07 ` Catalin Marinas
2018-12-19 15:30 ` Sebastian Andrzej Siewior
2018-12-20 1:46 ` He Zhe
2018-12-18 15:12 ` 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=20181130181956.eewrlaabtceekzyu@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=zhe.he@windriver.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