Re: [PATCH] mm: remove unintentional voluntary preemption in get_mmap_lock_carefully

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 21 Aug 2023 at 05:58, Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> The might_sleep() is clearly safe, but I thought of a different take on
> the problem you've found, which is that we used to check need_resched
> on _every_ page fault, because we used to take the mmap_lock on every
> page fault.  Now we only check it on the minority of page faults which
> can't be handled under the VMA lock.  But we can't just slam a
> might_resched() into the start of the fault handler, because of the
> problem you outlined above.

Bah.

I decided that there is no way the might_sleep() can be the right
thing to do inside get_mmap_lock_carefully(), because the whole point
of that function existing is that we might have a kernel bug causing a
wild pointer access.

And that kernel bug would be about the subsequent oops, not the fact
that we might be sleeping in a bad context.

So I have just removed the existing might_sleep() entirely, because
both the warning it can generate _and_ the voluntary scheduling point
are bad things in that context.

I do think that maybe we should then re-introduce the might_sleep() in
some actually appropriate place in the page fault path, which might be
'handle_mm_fault()'.

But I think that's a separate - if related - issue to the whole "this
was always the wrong point for might_sleep()" issue that Mateusz
noticed.

We are generally much too timid about removing old debug checks that
don't really make sense.

               Linus




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux