git: 5dc9004b72cf - stable/13 - vm_page: Break reservations to handle noobj allocations

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 03 Nov 2021 17:54:06 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=5dc9004b72cf0fb312e9b1136375432d1b31449c

commit 5dc9004b72cf0fb312e9b1136375432d1b31449c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-10-21 15:46:25 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-03 17:44:47 +0000

    vm_page: Break reservations to handle noobj allocations
    
    vm_reserv_reclaim_*() will release pages to the default freepool, not
    the direct freepool from which noobj allocations are drawn.  But if both
    pools are empty, the noobj allocator variants must break reservations to
    make progress.
    
    Reported by:    cy
    Reviewed by:    kib (previous version)
    Fixes:  b498f71bc56a ("vm_page: Add a new page allocator interface for unnamed pages")
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d7acbe481d17ccb81c2b879b9731c83b018f3094)
---
 sys/vm/vm_page.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 90e45ffbde74..6be310531924 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -2430,8 +2430,14 @@ again:
 			m = vm_phys_alloc_freelist_pages(domain, freelist,
 			    VM_FREEPOOL_DIRECT, 0);
 		vm_domain_free_unlock(vmd);
-		if (m == NULL)
+		if (m == NULL) {
 			vm_domain_freecnt_inc(vmd, 1);
+#if VM_NRESERVLEVEL > 0
+			if (freelist == VM_NFREELIST &&
+			    vm_reserv_reclaim_inactive(domain))
+				goto again;
+#endif
+		}
 	}
 	if (m == NULL) {
 		if (vm_domain_alloc_fail(vmd, NULL, req))