Fix handling of WAITFAIL in vm_page_grab() and vm_page_grab_pages().

After sleeping through a memory shortage, we must return NULL rather
than retry.

Discussed with:	jeff
Reported by:	pho
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2020-02-13 23:18:35 +00:00
parent cefc92e1a2
commit 06ef60525f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357893

View File

@ -4258,7 +4258,7 @@ vm_page_grab(vm_object_t object, vm_pindex_t pindex, int allocflags)
return (NULL);
m = vm_page_alloc(object, pindex, pflags);
if (m == NULL) {
if ((allocflags & VM_ALLOC_NOWAIT) != 0)
if ((allocflags & (VM_ALLOC_NOWAIT | VM_ALLOC_WAITFAIL)) != 0)
return (NULL);
goto retrylookup;
}
@ -4466,7 +4466,8 @@ vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags,
m = vm_page_alloc_after(object, pindex + i,
pflags | VM_ALLOC_COUNT(count - i), mpred);
if (m == NULL) {
if ((allocflags & VM_ALLOC_NOWAIT) != 0)
if ((allocflags & (VM_ALLOC_NOWAIT |
VM_ALLOC_WAITFAIL)) != 0)
break;
goto retrylookup;
}