Messages in this thread | | | Date | Sun, 20 Aug 2023 19:12:16 +0100 | From | Matthew Wilcox <> | Subject | Re: [PATCH] mm: remove unintentional voluntary preemption in get_mmap_lock_carefully |
| |
On Sun, Aug 20, 2023 at 12:43:03PM +0200, Mateusz Guzik wrote: > Found by checking off-CPU time during kernel build (like so: > "offcputime-bpfcc -Ku"), sample backtrace: > finish_task_switch.isra.0 > __schedule > __cond_resched > lock_mm_and_find_vma > do_user_addr_fault > exc_page_fault > asm_exc_page_fault > - sh (4502)
Now I'm awake, this backtrace really surprises me. Do we not check need_resched on entry? It seems terribly unlikely that need_resched gets set between entry and getting to this point, so I guess we must not.
I suggest the version of the patch which puts might_sleep() before the mmap_read_trylock() is the right one to apply. It's basically what we've done forever, except that now we'll be rescheduling without the mmap lock held, which just seems like an overall win.
| |