Take the size of allocation into account when checking the kernel reserve.
authorkettenis <kettenis@openbsd.org>
Thu, 2 Jun 2022 18:00:53 +0000 (18:00 +0000)
committerkettenis <kettenis@openbsd.org>
Thu, 2 Jun 2022 18:00:53 +0000 (18:00 +0000)
ok mpi@

sys/uvm/uvm_pmemrange.c

index 3e33efd..7a659ef 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_pmemrange.c,v 1.61 2021/03/12 14:15:49 jsg Exp $  */
+/*     $OpenBSD: uvm_pmemrange.c,v 1.62 2022/06/02 18:00:53 kettenis Exp $     */
 
 /*
  * Copyright (c) 2009, 2010 Ariane van der Steldt <ariane@stack.nl>
@@ -959,7 +959,7 @@ again:
         * [3]  only pagedaemon "reserved" pages remain and
         *        the requestor isn't the pagedaemon nor the syncer.
         */
-       if ((uvmexp.free <= uvmexp.reserve_kernel) &&
+       if ((uvmexp.free <= (uvmexp.reserve_kernel + count)) &&
            !(flags & UVM_PLA_USERESERVE)) {
                uvm_unlock_fpageq();
                return ENOMEM;