Module Name:    src
Committed By:   mlelstv
Date:           Sun Nov  4 13:48:27 UTC 2018

Modified Files:
        src/sys/uvm: uvm_glue.c uvm_km.c

Log Message:
PMAP_MAP_POOLPAGE must not fail. Trigger assertion here instead of
panic later from failing PR_WAITOK memory allocations.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/uvm/uvm_glue.c
cvs rdiff -u -r1.144 -r1.145 src/sys/uvm/uvm_km.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.164 src/sys/uvm/uvm_glue.c:1.165
--- src/sys/uvm/uvm_glue.c:1.164	Wed Aug 22 12:07:43 2018
+++ src/sys/uvm/uvm_glue.c	Sun Nov  4 13:48:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.164 2018/08/22 12:07:43 maxv Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.165 2018/11/04 13:48:27 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.164 2018/08/22 12:07:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.165 2018/11/04 13:48:27 mlelstv Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -246,7 +246,6 @@ uarea_poolpage_alloc(struct pool *pp, in
 	if (USPACE == PAGE_SIZE && USPACE_ALIGN == 0) {
 		struct vm_page *pg;
 		vaddr_t va;
-
 #if defined(PMAP_ALLOC_POOLPAGE)
 		pg = PMAP_ALLOC_POOLPAGE(
 		   ((flags & PR_WAITOK) == 0 ? UVM_KMF_NOWAIT : 0));
@@ -257,8 +256,7 @@ uarea_poolpage_alloc(struct pool *pp, in
 		if (pg == NULL)
 			return NULL;
 		va = PMAP_MAP_POOLPAGE(VM_PAGE_TO_PHYS(pg));
-		if (va == 0)
-			uvm_pagefree(pg);
+		KASSERT(va != 0);
 		return (void *)va;
 	}
 #endif

Index: src/sys/uvm/uvm_km.c
diff -u src/sys/uvm/uvm_km.c:1.144 src/sys/uvm/uvm_km.c:1.145
--- src/sys/uvm/uvm_km.c:1.144	Sat Oct 28 00:37:13 2017
+++ src/sys/uvm/uvm_km.c	Sun Nov  4 13:48:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_km.c,v 1.144 2017/10/28 00:37:13 pgoyette Exp $	*/
+/*	$NetBSD: uvm_km.c,v 1.145 2018/11/04 13:48:27 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -152,7 +152,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.144 2017/10/28 00:37:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.145 2018/11/04 13:48:27 mlelstv Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -786,10 +786,7 @@ again:
 			return ENOMEM;
 		}
 		va = PMAP_MAP_POOLPAGE(VM_PAGE_TO_PHYS(pg));
-		if (__predict_false(va == 0)) {
-			uvm_pagefree(pg);
-			return ENOMEM;
-		}
+		KASSERT(va != 0);
 		*addr = va;
 		return 0;
 	}

Reply via email to