lkml.org 
[lkml]   [2023]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2023-08-20 20:17    [W:1.289 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site