Re: [PATCH] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation

From: Michal Hocko

Date: Wed Aug 12 2026 - 04:22:03 EST


On Tue 11-08-26 10:42:29, Steven Rostedt wrote:
> On Tue, 11 Aug 2026 15:33:18 +0100
> David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote:
>
> > > If might_sleep doesn't work sanely at all in preempt_rt then just
> > > globally turn it off?
> >
> > Turn might_sleep off? Or PREEMPT_RT? :)
> >
> > The RT maintainers are on this thread if you want to pick either of
> > those fights... that was not the course of action I chose to take.
>
> I guess the question is, what exactly is the reason for sleeping to be
> prohibited? In RT, sleeping is allowed in most context because most context
> are threads (like interrupt handlers and such). Now, you still can't sleep
> in NMIs and hard interrupt handlers that were not converted to threads, but
> I'm not sure that's the case here anyway.
>
> If the non_block_start() is just a big hammer to make sure things are fine
> in non-RT, it will likely still be fine in RT even though it may block and
> sleep. But what it blocks on are sleeping spin locks that likely would not
> cause an issue here if they didn't cause an issue in non-RT.

Yes, this makes a lot of sense to me. While it is not really great that
the oom_repaer gets blocked by a RT sleeping lock because it delays the
whole operation this shouldn't break the "do not make any direct or
indirect dependency to MM" assumption as those locks are normally
spinlocks so there is no way to depend on blockable allocations.

So the warning is mostly a false positive on RT configs and what you
propose below makes sense.

>
> Thus, perhaps something like this:
>
> if (ops->invalidate_range_start) {
> int _ret;
>
> if (!IS_ENABLED(CONFIG_PREEMPT_RT) && !mmu_notifier_range_blockable(range))
> non_block_start();
> _ret = ops->invalidate_range_start(subscription, range);
> if (!IS_ENABLED(CONFIG_PREEMPT_RT) && !mmu_notifier_range_blockable(range))
> non_block_end();
>
> ?

--
Michal Hocko
SUSE Labs