On Wed, Mar 9, 2022 at 12:37 PM Andreas Gruenbacher <agruenba@xxxxxxxxxx> wrote: > > It's a moot point now, but I don't think handle_mm_fault would have > returned VM_FAULT_RETRY without FAULT_FLAG_ALLOW_RETRY, so there > wouldn't have been any NULL pointer accesses. No, it really does - FAULT_FLAG_KILLABLE will trigger the code in page_lock_or_retry() (->__folio_lock_or_retry) even without FAULT_FLAG_ALLOW_RETRY. So lock_page_or_retry() will drop the mmap_sem and return false, and then you have locked = lock_page_or_retry(page, vma->vm_mm, vmf->flags); if (!locked) { ret |= VM_FAULT_RETRY; goto out_release; } for the swapin case. And mm/filemap.c has essentially the same logic in lock_folio_maybe_drop_mmap(), although the syntax is quite different. Basically FAULT_FLAG_KILLABLE implies a kind of "half-way ALLOW_RETRY" - allow aborting, but only for the fatal signal case. Linus