Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Assert KM_SLEEP xor KM_NOSLEEP in all kmem allocation.



details:   https://anonhg.NetBSD.org/src/rev/426be6558437
branches:  trunk
changeset: 827722:426be6558437
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Nov 09 23:20:12 2017 +0000

description:
Assert KM_SLEEP xor KM_NOSLEEP in all kmem allocation.

diffstat:

 sys/kern/subr_kmem.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 5788a3c2c690 -r 426be6558437 sys/kern/subr_kmem.c
--- a/sys/kern/subr_kmem.c      Thu Nov 09 22:52:26 2017 +0000
+++ b/sys/kern/subr_kmem.c      Thu Nov 09 23:20:12 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kmem.c,v 1.64 2017/11/07 18:35:57 christos Exp $  */
+/*     $NetBSD: subr_kmem.c,v 1.65 2017/11/09 23:20:12 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.64 2017/11/07 18:35:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.65 2017/11/09 23:20:12 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kmem.h"
@@ -260,6 +260,9 @@
 
        KASSERT(requested_size > 0);
 
+       KASSERT((kmflags & KM_SLEEP) || (kmflags & KM_NOSLEEP));
+       KASSERT(!(kmflags & KM_SLEEP) || !(kmflags & KM_NOSLEEP));
+
 #ifdef KMEM_GUARD
        if (kmem_guard_enabled) {
                return kmem_guard_alloc(&kmem_guard, requested_size,



Home | Main Index | Thread Index | Old Index