From: Peter Zijlstra <peterz@infradead.org>
To: Michal Hocko <mhocko@suse.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
"Paul E . McKenney" <paulmck@kernel.org>,
Shakeel Butt <shakeelb@google.com>,
tglx@linutronix.de, john.ogness@linutronix.de, urezki@gmail.com,
ast@fb.com, Eric Dumazet <edumazet@google.com>,
Mina Almasry <almasrymina@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] hugetlb: select PREEMPT_COUNT if HUGETLB_PAGE for in_atomic use
Date: Thu, 11 Mar 2021 10:32:24 +0100 [thread overview]
Message-ID: <YEnjqLpGU2LHaysv@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YEncYrWCVn2/20/C@dhcp22.suse.cz>
On Thu, Mar 11, 2021 at 10:01:22AM +0100, Michal Hocko wrote:
> On Thu 11-03-21 09:46:30, Peter Zijlstra wrote:
> > On Wed, Mar 10, 2021 at 06:13:21PM -0800, Mike Kravetz wrote:
> > > from irq context. Changing the check in the code from !in_task to
> > > in_atomic would handle the situations when called with irqs disabled.
> >
> > It does not. local_irq_disable() does not change preempt_count().
>
> You are right. Earlier I was suggesting to check of irq_disabled() as
> well http://lkml.kernel.org/r/YD4I+VPr3UNt063H@dhcp22.suse.cz
>
> back then it was not really clear to me that in fact we do care about
> spin locks more than irq disabled code. I am not even sure whether we
> need to care about irq disabled regions without any locks held that
> wouldn't be covered by in_atomic. But it would be safer to add
> irq_disabled check as well.
Safer still is always doing it, replace it with if (true).
What's the purpose, doing the minimal 'correct', of the maximal safe
solution?
The whole changelog reads like a trainwreck, but akpm already commented
on that. I picked out a small factual incorrectness, simply because if
you can't get that right, the whole argument looses weight.
That said, I don't think you actually need it, if as you write the lock
should be IRQ-safe, then you're worried about the IRQ recursion
deadlock:
spin_lock(&A);
<IRQ>
spin_lock(&A);
And that obviously cannot happen when IRQs are disabled, even if you
were holding a lock.
Anyway, I think I support Andrew here, this needs proper fixing, not
bandaids.
next prev parent reply other threads:[~2021-03-11 9:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 2:13 Mike Kravetz
2021-03-11 5:43 ` Andrew Morton
2021-03-11 8:20 ` Michal Hocko
2021-03-11 8:26 ` Michal Hocko
2021-03-11 8:27 ` Michal Hocko
2021-03-11 8:46 ` Peter Zijlstra
2021-03-11 9:01 ` Michal Hocko
2021-03-11 9:32 ` Peter Zijlstra [this message]
2021-03-11 9:44 ` Michal Hocko
2021-03-11 9:52 ` Peter Zijlstra
2021-03-11 11:09 ` Michal Hocko
2021-03-11 11:36 ` Peter Zijlstra
2021-03-11 12:02 ` Michal Hocko
2021-03-11 17:25 ` Mike Kravetz
2021-03-11 12:49 ` Michal Hocko
2021-03-11 17:50 ` Paul E. McKenney
2021-03-11 9:49 ` Peter Zijlstra
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=YEnjqLpGU2LHaysv@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=ast@fb.com \
--cc=edumazet@google.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=paulmck@kernel.org \
--cc=shakeelb@google.com \
--cc=tglx@linutronix.de \
--cc=urezki@gmail.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