Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm PMAP_MAP_POOLPAGE must not fail. Trigger assertion h...



details:   https://anonhg.NetBSD.org/src/rev/893cd685e9b0
branches:  trunk
changeset: 994374:893cd685e9b0
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Nov 04 13:48:27 2018 +0000

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

diffstat:

 sys/uvm/uvm_glue.c |  8 +++-----
 sys/uvm/uvm_km.c   |  9 +++------
 2 files changed, 6 insertions(+), 11 deletions(-)

diffs (66 lines):

diff -r 6daf93cabbee -r 893cd685e9b0 sys/uvm/uvm_glue.c
--- a/sys/uvm/uvm_glue.c        Sun Nov 04 12:48:01 2018 +0000
+++ b/sys/uvm/uvm_glue.c        Sun Nov 04 13:48:27 2018 +0000
@@ -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 @@
        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 @@
                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
diff -r 6daf93cabbee -r 893cd685e9b0 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Sun Nov 04 12:48:01 2018 +0000
+++ b/sys/uvm/uvm_km.c  Sun Nov 04 13:48:27 2018 +0000
@@ -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 @@
                        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;
        }



Home | Main Index | Thread Index | Old Index