CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Wed Apr 2 16:14:50 UTC 2014 Modified Files: src/sys/kern: subr_vmem.c Log Message: bt_refill is and must be called with VM_NOSLEEP set, assert this fix error path if pool_get returns NULL To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/kern/subr_vmem.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.90 src/sys/kern/subr_vmem.c:1.91 --- src/sys/kern/subr_vmem.c:1.90 Thu Mar 20 06:48:22 2014 +++ src/sys/kern/subr_vmem.c Wed Apr 2 16:14:50 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.90 2014/03/20 06:48:22 mlelstv Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.91 2014/04/02 16:14:50 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -46,7 +46,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.90 2014/03/20 06:48:22 mlelstv Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.91 2014/04/02 16:14:50 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -230,6 +230,8 @@ bt_refill(vmem_t *vm, vm_flag_t flags) { bt_t *bt; + KASSERT(flags VM_NOSLEEP); + VMEM_LOCK(vm); if (vm-vm_nfreetags BT_MINRESERVE) { VMEM_UNLOCK(vm); @@ -251,22 +253,21 @@ bt_refill(vmem_t *vm, vm_flag_t flags) while (vm-vm_nfreetags = BT_MINRESERVE) { VMEM_UNLOCK(vm); mutex_enter(vmem_btag_refill_lock); - bt = pool_get(vmem_btag_pool, - (flags VM_SLEEP) ? PR_WAITOK: PR_NOWAIT); + bt = pool_get(vmem_btag_pool, PR_NOWAIT); mutex_exit(vmem_btag_refill_lock); VMEM_LOCK(vm); - if (bt == NULL (flags VM_SLEEP) == 0) + if (bt == NULL) break; LIST_INSERT_HEAD(vm-vm_freetags, bt, bt_freelist); vm-vm_nfreetags++; } - VMEM_UNLOCK(vm); - if (vm-vm_nfreetags == 0) { + VMEM_UNLOCK(vm); return ENOMEM; } + VMEM_UNLOCK(vm); if (kmem_meta_arena != NULL) { bt_refill(kmem_arena, (flags ~VM_FITMASK)
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Wed Apr 2 18:09:10 UTC 2014 Modified Files: src/sys/kern: subr_vmem.c Log Message: make condition for ENOMEM consistent with allocation requirement To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/kern/subr_vmem.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.91 src/sys/kern/subr_vmem.c:1.92 --- src/sys/kern/subr_vmem.c:1.91 Wed Apr 2 16:14:50 2014 +++ src/sys/kern/subr_vmem.c Wed Apr 2 18:09:10 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.91 2014/04/02 16:14:50 para Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.92 2014/04/02 18:09:10 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -46,7 +46,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.91 2014/04/02 16:14:50 para Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.92 2014/04/02 18:09:10 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -262,7 +262,7 @@ bt_refill(vmem_t *vm, vm_flag_t flags) vm-vm_nfreetags++; } - if (vm-vm_nfreetags == 0) { + if (vm-vm_nfreetags = BT_MINRESERVE) { VMEM_UNLOCK(vm); return ENOMEM; }
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Wed Apr 2 16:14:50 UTC 2014 Modified Files: src/sys/kern: subr_vmem.c Log Message: bt_refill is and must be called with VM_NOSLEEP set, assert this fix error path if pool_get returns NULL To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Wed Apr 2 18:09:10 UTC 2014 Modified Files: src/sys/kern: subr_vmem.c Log Message: make condition for ENOMEM consistent with allocation requirement To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: para Date: Tue Mar 11 20:54:29 UTC 2014 Modified Files: src/sys/arch/amd64/amd64: trap.c Log Message: mark a diagnostic only variable To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/arch/amd64/amd64/trap.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/arch/amd64/amd64/trap.c diff -u src/sys/arch/amd64/amd64/trap.c:1.77 src/sys/arch/amd64/amd64/trap.c:1.78 --- src/sys/arch/amd64/amd64/trap.c:1.77 Wed Feb 12 19:53:49 2014 +++ src/sys/arch/amd64/amd64/trap.c Tue Mar 11 20:54:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.77 2014/02/12 19:53:49 dsl Exp $ */ +/* $NetBSD: trap.c,v 1.78 2014/03/11 20:54:29 para Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.77 2014/02/12 19:53:49 dsl Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.78 2014/03/11 20:54:29 para Exp $); #include opt_ddb.h #include opt_kgdb.h @@ -705,7 +705,7 @@ startlwp(void *arg) { ucontext_t *uc = arg; lwp_t *l = curlwp; - int error; + int error __diagused; error = cpu_setmcontext(l, uc-uc_mcontext, uc-uc_flags); KASSERT(error == 0);
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: para Date: Tue Mar 11 20:55:19 UTC 2014 Modified Files: src/sys/arch/x86/x86: vm_machdep.c Log Message: mark a diagnostic only variable To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/x86/vm_machdep.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/arch/x86/x86/vm_machdep.c diff -u src/sys/arch/x86/x86/vm_machdep.c:1.24 src/sys/arch/x86/x86/vm_machdep.c:1.25 --- src/sys/arch/x86/x86/vm_machdep.c:1.24 Tue Feb 25 22:16:52 2014 +++ src/sys/arch/x86/x86/vm_machdep.c Tue Mar 11 20:55:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.24 2014/02/25 22:16:52 dsl Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.25 2014/03/11 20:55:19 para Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -80,7 +80,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.24 2014/02/25 22:16:52 dsl Exp $); +__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.25 2014/03/11 20:55:19 para Exp $); #include opt_mtrr.h @@ -270,7 +270,7 @@ paddr_t kvtop(void *addr) { paddr_t pa; - bool ret; + bool ret __diagused; ret = pmap_extract(pmap_kernel(), (vaddr_t)addr, pa); KASSERT(ret == true);
CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: para Date: Tue Mar 11 20:54:29 UTC 2014 Modified Files: src/sys/arch/amd64/amd64: trap.c Log Message: mark a diagnostic only variable To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/arch/amd64/amd64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: para Date: Tue Mar 11 20:55:19 UTC 2014 Modified Files: src/sys/arch/x86/x86: vm_machdep.c Log Message: mark a diagnostic only variable To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/x86/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Mon Feb 17 20:40:06 UTC 2014 Modified Files: src/sys/kern: subr_pool.c subr_vmem.c Log Message: replace vmem(9) custom boundary tag allocation with a pool(9) To generate a diff of this commit: cvs rdiff -u -r1.200 -r1.201 src/sys/kern/subr_pool.c cvs rdiff -u -r1.87 -r1.88 src/sys/kern/subr_vmem.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/kern/subr_pool.c diff -u src/sys/kern/subr_pool.c:1.200 src/sys/kern/subr_pool.c:1.201 --- src/sys/kern/subr_pool.c:1.200 Mon Mar 11 21:37:54 2013 +++ src/sys/kern/subr_pool.c Mon Feb 17 20:40:06 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.200 2013/03/11 21:37:54 pooka Exp $ */ +/* $NetBSD: subr_pool.c,v 1.201 2014/02/17 20:40:06 para Exp $ */ /*- * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010 @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_pool.c,v 1.200 2013/03/11 21:37:54 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_pool.c,v 1.201 2014/02/17 20:40:06 para Exp $); #include opt_ddb.h #include opt_lockdebug.h @@ -561,9 +561,10 @@ pool_init(struct pool *pp, size_t size, /* See the comment below about reserved bytes. */ trysize = palloc-pa_pagesz - ((align - ioff) % align); phsize = ALIGN(sizeof(struct pool_item_header)); - if ((pp-pr_roflags (PR_NOTOUCH | PR_NOALIGN)) == 0 + if (pp-pr_roflags PR_PHINPAGE || + ((pp-pr_roflags (PR_NOTOUCH | PR_NOALIGN)) == 0 (pp-pr_size MIN(palloc-pa_pagesz / 16, phsize 3) || - trysize / pp-pr_size == (trysize - phsize) / pp-pr_size)) { + trysize / pp-pr_size == (trysize - phsize) / pp-pr_size))) { /* Use the end of the page for the page header */ pp-pr_roflags |= PR_PHINPAGE; pp-pr_phoffset = off = palloc-pa_pagesz - phsize; Index: src/sys/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.87 src/sys/kern/subr_vmem.c:1.88 --- src/sys/kern/subr_vmem.c:1.87 Fri Nov 22 21:04:11 2013 +++ src/sys/kern/subr_vmem.c Mon Feb 17 20:40:06 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.87 2013/11/22 21:04:11 christos Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.88 2014/02/17 20:40:06 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -31,10 +31,22 @@ * - Magazines and Vmem: Extending the Slab Allocator * to Many CPUs and Arbitrary Resources * http://www.usenix.org/event/usenix01/bonwick.html + * + * locking the boundary tag pool: + * - A pool(9) is used for vmem boundary tags + * - During a pool get call the global vmem_btag_refill_lock is taken, + * to serialize access to the allocation reserve, but no other + * vmem arena locks. + * - During pool_put calls no vmem mutexes are locked. + * - pool_drain doesn't hold the pool's mutex while releasing memory to + * its backing therefore no interferance with any vmem mutexes. + * - The boundary tag pool is forced to put page headers into pool pages + * (PR_PHINPAGE) and not off page to avoid pool recursion. + * (due to sizeof(bt_t) it should be the case anyway) */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.87 2013/11/22 21:04:11 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.88 2014/02/17 20:40:06 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -75,14 +87,13 @@ __KERNEL_RCSID(0, $NetBSD: subr_vmem.c, #include sys/evcnt.h #define VMEM_EVCNT_DEFINE(name) \ struct evcnt vmem_evcnt_##name = EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, \ -vmemev, #name); \ +vmem, #name); \ EVCNT_ATTACH_STATIC(vmem_evcnt_##name); #define VMEM_EVCNT_INCR(ev) vmem_evcnt_##ev.ev_count++ #define VMEM_EVCNT_DECR(ev) vmem_evcnt_##ev.ev_count-- -VMEM_EVCNT_DEFINE(bt_pages) -VMEM_EVCNT_DEFINE(bt_count) -VMEM_EVCNT_DEFINE(bt_inuse) +VMEM_EVCNT_DEFINE(static_bt_count) +VMEM_EVCNT_DEFINE(static_bt_inuse) #define VMEM_CONDVAR_INIT(vm, wchan) cv_init(vm-vm_cv, wchan) #define VMEM_CONDVAR_DESTROY(vm) cv_destroy(vm-vm_cv) @@ -175,81 +186,56 @@ static int static_bt_count = STATIC_BT_C static struct vmem kmem_va_meta_arena_store; vmem_t *kmem_va_meta_arena; static struct vmem kmem_meta_arena_store; -vmem_t *kmem_meta_arena; +vmem_t *kmem_meta_arena = NULL; -static kmutex_t vmem_refill_lock; +static kmutex_t vmem_btag_refill_lock; static kmutex_t vmem_btag_lock; static LIST_HEAD(, vmem_btag) vmem_btag_freelist; static size_t vmem_btag_freelist_count = 0; -static size_t vmem_btag_count = STATIC_BT_COUNT; +static struct pool vmem_btag_pool; /* boundary tag */ -#define BT_PER_PAGE (PAGE_SIZE / sizeof(bt_t)) - static int bt_refill(vmem_t *vm, vm_flag_t flags); -static int -bt_refillglobal(vm_flag_t flags) +static void * +pool_page_alloc_vmem_meta(struct pool *pp, int flags) { + const vm_flag_t vflags = (flags PR_WAITOK) ? VM_SLEEP: VM_NOSLEEP; vmem_addr_t va; - bt_t *btp; - bt_t *bt; - int i; - - mutex_enter(vmem_refill_lock); + int ret; -
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Mon Feb 17 20:40:06 UTC 2014 Modified Files: src/sys/kern: subr_pool.c subr_vmem.c Log Message: replace vmem(9) custom boundary tag allocation with a pool(9) To generate a diff of this commit: cvs rdiff -u -r1.200 -r1.201 src/sys/kern/subr_pool.c cvs rdiff -u -r1.87 -r1.88 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: para Date: Sun Dec 15 17:15:34 UTC 2013 Modified Files: src/sys/dev/usb: ehci.c Log Message: mark variable usage, fix non DIAGNOSTIC non DEBUG build To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/sys/dev/usb/ehci.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/dev/usb/ehci.c diff -u src/sys/dev/usb/ehci.c:1.222 src/sys/dev/usb/ehci.c:1.223 --- src/sys/dev/usb/ehci.c:1.222 Sun Dec 15 10:25:23 2013 +++ src/sys/dev/usb/ehci.c Sun Dec 15 17:15:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.222 2013/12/15 10:25:23 skrll Exp $ */ +/* $NetBSD: ehci.c,v 1.223 2013/12/15 17:15:34 para Exp $ */ /* * Copyright (c) 2004-2012 The NetBSD Foundation, Inc. @@ -53,7 +53,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.222 2013/12/15 10:25:23 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.223 2013/12/15 17:15:34 para Exp $); #include ohci.h #include uhci.h @@ -3364,7 +3364,7 @@ ehci_device_request(usbd_xfer_handle xfe usb_device_request_t *req = xfer-request; usbd_device_handle dev = epipe-pipe.device; ehci_softc_t *sc = dev-bus-hci_private; - int addr = dev-address; + int addr __diagused = dev-address; ehci_soft_qtd_t *setup, *stat, *next; ehci_soft_qh_t *sqh; int isread;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: para Date: Sun Dec 15 17:15:34 UTC 2013 Modified Files: src/sys/dev/usb: ehci.c Log Message: mark variable usage, fix non DIAGNOSTIC non DEBUG build To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/sys/dev/usb/ehci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Tue Apr 16 21:13:39 UTC 2013 Modified Files: src/sys/kern: subr_kmem.c Log Message: addresses PR/47512 properly return NULL for failed allocations not 0x8 with size checks enabled. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/kern/subr_kmem.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/kern/subr_kmem.c diff -u src/sys/kern/subr_kmem.c:1.46 src/sys/kern/subr_kmem.c:1.47 --- src/sys/kern/subr_kmem.c:1.46 Sat Jul 21 11:45:04 2012 +++ src/sys/kern/subr_kmem.c Tue Apr 16 21:13:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kmem.c,v 1.46 2012/07/21 11:45:04 para Exp $ */ +/* $NetBSD: subr_kmem.c,v 1.47 2013/04/16 21:13:38 para Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.46 2012/07/21 11:45:04 para Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.47 2013/04/16 21:13:38 para Exp $); #include sys/param.h #include sys/callback.h @@ -226,8 +226,10 @@ kmem_intr_alloc(size_t size, km_flag_t k kmem_poison_check(p, size); FREECHECK_OUT(kmem_freecheck, p); kmem_size_set(p, size); + + return p + SIZE_SIZE; } - return p + SIZE_SIZE; + return p; } /*
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Tue Apr 16 21:13:39 UTC 2013 Modified Files: src/sys/kern: subr_kmem.c Log Message: addresses PR/47512 properly return NULL for failed allocations not 0x8 with size checks enabled. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/kern/subr_kmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: para Date: Mon Mar 18 13:36:23 UTC 2013 Modified Files: src/sys/kern: init_main.c init_sysctl.c vfs_bio.c src/sys/rump/librump/rumpkern: emul.c src/sys/sys: param.h systm.h Log Message: calculate vnode cache size based on the resource it gets allocated from this stops setting kern.maxvnodes to high so it exhausts available space in kmem http://mail-index.netbsd.org/tech-kern/2013/03/08/msg015095.html To generate a diff of this commit: cvs rdiff -u -r1.447 -r1.448 src/sys/kern/init_main.c cvs rdiff -u -r1.196 -r1.197 src/sys/kern/init_sysctl.c cvs rdiff -u -r1.242 -r1.243 src/sys/kern/vfs_bio.c cvs rdiff -u -r1.154 -r1.155 src/sys/rump/librump/rumpkern/emul.c cvs rdiff -u -r1.425 -r1.426 src/sys/sys/param.h cvs rdiff -u -r1.257 -r1.258 src/sys/sys/systm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.447 src/sys/kern/init_main.c:1.448 --- src/sys/kern/init_main.c:1.447 Thu Feb 21 01:39:55 2013 +++ src/sys/kern/init_main.c Mon Mar 18 13:36:21 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.447 2013/02/21 01:39:55 pgoyette Exp $ */ +/* $NetBSD: init_main.c,v 1.448 2013/03/18 13:36:21 para Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.447 2013/02/21 01:39:55 pgoyette Exp $); +__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.448 2013/03/18 13:36:21 para Exp $); #include opt_ddb.h #include opt_ipsec.h @@ -444,8 +444,8 @@ main(void) * 10% of memory for vnodes and associated data structures in the * assumed worst case. Do not provide fewer than NVNODE vnodes. */ - usevnodes = - calc_cache_size(kernel_map, 10, VNODE_VA_MAXPCT) / VNODE_COST; + usevnodes = calc_cache_size(vmem_size(kmem_arena, VMEM_FREE|VMEM_ALLOC), + 10, VNODE_KMEM_MAXPCT) / VNODE_COST; if (usevnodes desiredvnodes) desiredvnodes = usevnodes; #endif @@ -1078,20 +1078,17 @@ start_init(void *arg) } /* - * calculate cache size (in bytes) from physmem and vm_map size. + * calculate cache size (in bytes) from physmem and vsize. */ vaddr_t -calc_cache_size(struct vm_map *map, int pct, int va_pct) +calc_cache_size(vsize_t vsize, int pct, int va_pct) { paddr_t t; /* XXX should consider competing cache if any */ /* XXX should consider submaps */ t = (uintmax_t)physmem * pct / 100 * PAGE_SIZE; - if (map != NULL) { - vsize_t vsize; - - vsize = vm_map_max(map) - vm_map_min(map); + if (vsize != 0) { vsize = (uintmax_t)vsize * va_pct / 100; if (t vsize) { t = vsize; Index: src/sys/kern/init_sysctl.c diff -u src/sys/kern/init_sysctl.c:1.196 src/sys/kern/init_sysctl.c:1.197 --- src/sys/kern/init_sysctl.c:1.196 Thu Mar 7 18:02:54 2013 +++ src/sys/kern/init_sysctl.c Mon Mar 18 13:36:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: init_sysctl.c,v 1.196 2013/03/07 18:02:54 matt Exp $ */ +/* $NetBSD: init_sysctl.c,v 1.197 2013/03/18 13:36:22 para Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: init_sysctl.c,v 1.196 2013/03/07 18:02:54 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: init_sysctl.c,v 1.197 2013/03/18 13:36:22 para Exp $); #include opt_sysv.h #include opt_compat_netbsd.h @@ -961,8 +961,9 @@ sysctl_kern_maxvnodes(SYSCTLFN_ARGS) if (new_vnodes = 0) return (EINVAL); - /* Limits: 75% of KVA and physical memory. */ - new_max = calc_cache_size(kernel_map, 75, 75) / VNODE_COST; + /* Limits: 75% of kmem and physical memory. */ + new_max = calc_cache_size(vmem_size(kmem_arena, VMEM_FREE|VMEM_ALLOC), + 75, 75) / VNODE_COST; if (new_vnodes new_max) new_vnodes = new_max; Index: src/sys/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.242 src/sys/kern/vfs_bio.c:1.243 --- src/sys/kern/vfs_bio.c:1.242 Sun Dec 30 09:19:24 2012 +++ src/sys/kern/vfs_bio.c Mon Mar 18 13:36:22 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.242 2012/12/30 09:19:24 hannken Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.243 2013/03/18 13:36:22 para Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vfs_bio.c,v 1.242 2012/12/30 09:19:24 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: vfs_bio.c,v 1.243 2013/03/18 13:36:22 para Exp $); #include opt_bufcache.h @@ -396,6 +396,7 @@ u_long buf_memcalc(void) { u_long n; + vsize_t mapsz; /* * Determine the upper bound of memory to use for buffers. @@ -417,7 +418,8 @@ buf_memcalc(void) printf(forcing bufcache %d - 95, bufcache); bufcache = 95; } - n = calc_cache_size(buf_map, bufcache, + mapsz = vm_map_max(buf_map) - vm_map_min(buf_map); + n = calc_cache_size(mapsz, bufcache, (buf_map != kernel_map) ? 100 :
CVS commit: src/sys/arch/i386/include
Module Name:src Committed By: para Date: Mon Mar 18 16:32:32 UTC 2013 Modified Files: src/sys/arch/i386/include: pmap.h Log Message: i386 pmap.h got a forward declarition for vm_map from systm.h insert a forward declaration To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/arch/i386/include/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/include/pmap.h diff -u src/sys/arch/i386/include/pmap.h:1.115 src/sys/arch/i386/include/pmap.h:1.116 --- src/sys/arch/i386/include/pmap.h:1.115 Sun Feb 19 10:39:06 2012 +++ src/sys/arch/i386/include/pmap.h Mon Mar 18 16:32:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.115 2012/02/19 10:39:06 cherry Exp $ */ +/* $NetBSD: pmap.h,v 1.116 2013/03/18 16:32:32 para Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -400,6 +400,7 @@ pmap_pte_flush(void) #endif +struct vm_map; struct trapframe; int pmap_exec_fixup(struct vm_map *, struct trapframe *, struct pcb *);
CVS commit: src/sys
Module Name:src Committed By: para Date: Mon Mar 18 13:36:23 UTC 2013 Modified Files: src/sys/kern: init_main.c init_sysctl.c vfs_bio.c src/sys/rump/librump/rumpkern: emul.c src/sys/sys: param.h systm.h Log Message: calculate vnode cache size based on the resource it gets allocated from this stops setting kern.maxvnodes to high so it exhausts available space in kmem http://mail-index.netbsd.org/tech-kern/2013/03/08/msg015095.html To generate a diff of this commit: cvs rdiff -u -r1.447 -r1.448 src/sys/kern/init_main.c cvs rdiff -u -r1.196 -r1.197 src/sys/kern/init_sysctl.c cvs rdiff -u -r1.242 -r1.243 src/sys/kern/vfs_bio.c cvs rdiff -u -r1.154 -r1.155 src/sys/rump/librump/rumpkern/emul.c cvs rdiff -u -r1.425 -r1.426 src/sys/sys/param.h cvs rdiff -u -r1.257 -r1.258 src/sys/sys/systm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/i386/include
Module Name:src Committed By: para Date: Mon Mar 18 16:32:32 UTC 2013 Modified Files: src/sys/arch/i386/include: pmap.h Log Message: i386 pmap.h got a forward declarition for vm_map from systm.h insert a forward declaration To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/arch/i386/include/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/resolv
Module Name:src Committed By: para Date: Sat Feb 16 13:45:45 UTC 2013 Modified Files: src/lib/libc/resolv: res_send.c Log Message: two more type casts after type changes To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/resolv/res_send.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/resolv/res_send.c diff -u src/lib/libc/resolv/res_send.c:1.28 src/lib/libc/resolv/res_send.c:1.29 --- src/lib/libc/resolv/res_send.c:1.28 Sat Feb 16 13:37:01 2013 +++ src/lib/libc/resolv/res_send.c Sat Feb 16 13:45:45 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: res_send.c,v 1.28 2013/02/16 13:37:01 christos Exp $ */ +/* $NetBSD: res_send.c,v 1.29 2013/02/16 13:45:45 para Exp $ */ /* * Portions Copyright (C) 2004-2009 Internet Systems Consortium, Inc. (ISC) @@ -93,7 +93,7 @@ static const char sccsid[] = @(#)res_send.c 8.1 (Berkeley) 6/4/93; static const char rcsid[] = Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp; #else -__RCSID($NetBSD: res_send.c,v 1.28 2013/02/16 13:37:01 christos Exp $); +__RCSID($NetBSD: res_send.c,v 1.29 2013/02/16 13:45:45 para Exp $); #endif #endif /* LIBC_SCCS and not lint */ @@ -516,7 +516,7 @@ res_nsend(res_state statp, if (v_circuit) { /* Use VC; at most one attempt per server. */ tries = statp-retry; - n = send_vc(statp, buf, buflen, ans, anssiz, terrno, + n = send_vc(statp, buf, (size_t)buflen, ans, anssiz, terrno, ns); if (n 0) goto fail; @@ -756,7 +756,7 @@ send_vc(res_state statp, ns_put16((u_short)buflen, (u_char*)(void *)len); iov[0] = evConsIovec(len, INT16SZ); DE_CONST(buf, tmp); - iov[1] = evConsIovec(tmp, (int)buflen); + iov[1] = evConsIovec(tmp, (size_t)buflen); if (writev(statp-_vcsock, iov, 2) != (ssize_t)(INT16SZ + buflen)) { *terrno = errno; Perror(statp, stderr, write failed, errno);
CVS commit: src/lib/libc/resolv
Module Name:src Committed By: para Date: Sat Feb 16 13:45:45 UTC 2013 Modified Files: src/lib/libc/resolv: res_send.c Log Message: two more type casts after type changes To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/lib/libc/resolv/res_send.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys
On 2013-01-30 12:46, Izumi Tsutsui wrote: Module Name: src Committed By:para Date:Tue Jan 29 21:26:25 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c src/sys/rump/librump/rumpkern: vm.c src/sys/sys: vmem.h vmem_impl.h Log Message: make vmem(9) ready to be used early during bootstrap to replace extent(9) pass memory for vmem structs into the initialization function and do away with the static pool of vmem structs. remove special bootstrapping of the quantum cache pools of the kmem_va_arena as memory for pool_caches is allocated via pool_allocator_meta which is fully operational at this point. Is this change reviewed by vm guys (especailly yamt@)? No, there was some discussion about it with dyoung@ and skrll@ There is no expected functional change to vm. It's all about how some vmem internal structs are allocated during bootstrap to make vmem usable earlier during bootstrap. As always communication could have been better. If so it's much better to note it in the commit log. sure. -- Lars
CVS commit: src/sys
Module Name:src Committed By: para Date: Tue Jan 29 21:26:25 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c src/sys/rump/librump/rumpkern: vm.c src/sys/sys: vmem.h vmem_impl.h Log Message: make vmem(9) ready to be used early during bootstrap to replace extent(9) pass memory for vmem structs into the initialization function and do away with the static pool of vmem structs. remove special bootstrapping of the quantum cache pools of the kmem_va_arena as memory for pool_caches is allocated via pool_allocator_meta which is fully operational at this point. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.134 -r1.135 src/sys/rump/librump/rumpkern/vm.c cvs rdiff -u -r1.19 -r1.20 src/sys/sys/vmem.h cvs rdiff -u -r1.1 -r1.2 src/sys/sys/vmem_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.79 src/sys/kern/subr_vmem.c:1.80 --- src/sys/kern/subr_vmem.c:1.79 Sat Jan 26 15:18:00 2013 +++ src/sys/kern/subr_vmem.c Tue Jan 29 21:26:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.79 2013/01/26 15:18:00 para Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.80 2013/01/29 21:26:24 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,11 +34,10 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.79 2013/01/26 15:18:00 para Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.80 2013/01/29 21:26:24 para Exp $); #if defined(_KERNEL) #include opt_ddb.h -#define QCACHE #endif /* defined(_KERNEL) */ #include sys/param.h @@ -53,6 +52,7 @@ __KERNEL_RCSID(0, $NetBSD: subr_vmem.c, #include sys/kmem.h #include sys/pool.h #include sys/vmem.h +#include sys/vmem_impl.h #include sys/workqueue.h #include sys/atomic.h #include uvm/uvm.h @@ -61,7 +61,13 @@ __KERNEL_RCSID(0, $NetBSD: subr_vmem.c, #include uvm/uvm_page.h #include uvm/uvm_pdaemon.h #else /* defined(_KERNEL) */ +#include stdio.h +#include errno.h +#include assert.h +#include stdlib.h +#include string.h #include ../sys/vmem.h +#include ../sys/vmem_impl.h #endif /* defined(_KERNEL) */ @@ -78,28 +84,23 @@ VMEM_EVCNT_DEFINE(bt_pages) VMEM_EVCNT_DEFINE(bt_count) VMEM_EVCNT_DEFINE(bt_inuse) -#define LOCK_DECL(name) \ -kmutex_t name; char lockpad[COHERENCY_UNIT - sizeof(kmutex_t)] - -#define CONDVAR_DECL(name) \ -kcondvar_t name +#define VMEM_CONDVAR_INIT(vm, wchan) cv_init(vm-vm_cv, wchan) +#define VMEM_CONDVAR_DESTROY(vm) cv_destroy(vm-vm_cv) +#define VMEM_CONDVAR_WAIT(vm) cv_wait(vm-vm_cv, vm-vm_lock) +#define VMEM_CONDVAR_BROADCAST(vm) cv_broadcast(vm-vm_cv) #else /* defined(_KERNEL) */ -#include stdio.h -#include errno.h -#include assert.h -#include stdlib.h -#include string.h #define VMEM_EVCNT_INCR(ev) /* nothing */ #define VMEM_EVCNT_DECR(ev) /* nothing */ -#define UNITTEST -#define KASSERT(a) assert(a) -#define LOCK_DECL(name) /* nothing */ -#define CONDVAR_DECL(name) /* nothing */ #define VMEM_CONDVAR_INIT(vm, wchan) /* nothing */ +#define VMEM_CONDVAR_DESTROY(vm) /* nothing */ +#define VMEM_CONDVAR_WAIT(vm) /* nothing */ #define VMEM_CONDVAR_BROADCAST(vm) /* nothing */ + +#define UNITTEST +#define KASSERT(a) assert(a) #define mutex_init(a, b, c) /* nothing */ #define mutex_destroy(a) /* nothing */ #define mutex_enter(a) /* nothing */ @@ -110,74 +111,25 @@ VMEM_EVCNT_DEFINE(bt_inuse) #define panic(...) printf(__VA_ARGS__); abort() #endif /* defined(_KERNEL) */ -struct vmem; -struct vmem_btag; - #if defined(VMEM_SANITY) static void vmem_check(vmem_t *); #else /* defined(VMEM_SANITY) */ #define vmem_check(vm) /* nothing */ #endif /* defined(VMEM_SANITY) */ -#define VMEM_MAXORDER (sizeof(vmem_size_t) * CHAR_BIT) - #define VMEM_HASHSIZE_MIN 1 /* XXX */ #define VMEM_HASHSIZE_MAX 65536 /* XXX */ #define VMEM_HASHSIZE_INIT 1 #define VM_FITMASK (VM_BESTFIT | VM_INSTANTFIT) -CIRCLEQ_HEAD(vmem_seglist, vmem_btag); -LIST_HEAD(vmem_freelist, vmem_btag); -LIST_HEAD(vmem_hashlist, vmem_btag); - -#if defined(QCACHE) -#define VMEM_QCACHE_IDX_MAX 32 - -#define QC_NAME_MAX 16 - -struct qcache { - pool_cache_t qc_cache; - vmem_t *qc_vmem; - char qc_name[QC_NAME_MAX]; -}; -typedef struct qcache qcache_t; -#define QC_POOL_TO_QCACHE(pool) ((qcache_t *)(pool-pr_qcache)) -#endif /* defined(QCACHE) */ - -#define VMEM_NAME_MAX 16 - -/* vmem arena */ -struct vmem { - CONDVAR_DECL(vm_cv); - LOCK_DECL(vm_lock); - vm_flag_t vm_flags; - vmem_import_t *vm_importfn; - vmem_release_t *vm_releasefn; - size_t vm_nfreetags; - LIST_HEAD(, vmem_btag) vm_freetags; - void *vm_arg; - struct vmem_seglist vm_seglist; - struct vmem_freelist vm_freelist[VMEM_MAXORDER]; - size_t vm_hashsize; - size_t vm_nbusytag; - struct vmem_hashlist *vm_hashlist; - struct vmem_hashlist vm_hash0; - size_t vm_quantum_mask; - int vm_quantum_shift; - size_t vm_size; -
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Tue Jan 29 21:29:41 UTC 2013 Modified Files: src/sys/uvm: uvm_km.c Log Message: bring file up to date for previous vmem changes. To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 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_km.c diff -u src/sys/uvm/uvm_km.c:1.137 src/sys/uvm/uvm_km.c:1.138 --- src/sys/uvm/uvm_km.c:1.137 Sat Jan 26 15:18:01 2013 +++ src/sys/uvm/uvm_km.c Tue Jan 29 21:29:40 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.137 2013/01/26 15:18:01 para Exp $ */ +/* $NetBSD: uvm_km.c,v 1.138 2013/01/29 21:29:40 para 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.137 2013/01/26 15:18:01 para Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.138 2013/01/29 21:29:40 para Exp $); #include opt_uvmhist.h @@ -180,6 +180,7 @@ __KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1 #include sys/proc.h #include sys/pool.h #include sys/vmem.h +#include sys/vmem_impl.h #include sys/kmem.h #include uvm/uvm.h @@ -202,7 +203,9 @@ int nkmempages = 0; vaddr_t kmembase; vsize_t kmemsize; +static struct vmem kmem_arena_store; vmem_t *kmem_arena = NULL; +static struct vmem kmem_va_arena_store; vmem_t *kmem_va_arena; /* @@ -324,10 +327,9 @@ uvm_km_bootstrap(vaddr_t start, vaddr_t kernel_map = kernel_map_store; pool_subsystem_init(); - vmem_bootstrap(); - kmem_arena = vmem_create(kmem, kmembase, kmemsize, PAGE_SIZE, - NULL, NULL, NULL, + kmem_arena = vmem_init(kmem_arena_store, kmem, + kmembase, kmemsize, PAGE_SIZE, NULL, NULL, NULL, 0, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM); #ifdef PMAP_GROWKERNEL /* @@ -342,15 +344,15 @@ uvm_km_bootstrap(vaddr_t start, vaddr_t } #endif - vmem_init(kmem_arena); + vmem_subsystem_init(kmem_arena); UVMHIST_LOG(maphist, kmem vmem created (base=%#PRIxVADDR , size=%#PRIxVSIZE, kmembase, kmemsize, 0,0); - kmem_va_arena = vmem_create(kva, 0, 0, PAGE_SIZE, - vmem_alloc, vmem_free, kmem_arena, - (kmem_arena_small ? 4 : 8) * PAGE_SIZE, - VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM); + kmem_va_arena = vmem_init(kmem_va_arena_store, kva, + 0, 0, PAGE_SIZE, vmem_alloc, vmem_free, kmem_arena, + (kmem_arena_small ? 4 : VMEM_QCACHE_IDX_MAX) * PAGE_SIZE, + VM_NOSLEEP, IPL_VM); UVMHIST_LOG(maphist, - done, 0,0,0,0); }
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Tue Jan 29 21:37:04 UTC 2013 Modified Files: src/sys/uvm: uvm_init.c Log Message: improve on comments To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/uvm/uvm_init.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_init.c diff -u src/sys/uvm/uvm_init.c:1.44 src/sys/uvm/uvm_init.c:1.45 --- src/sys/uvm/uvm_init.c:1.44 Fri Feb 17 23:41:02 2012 +++ src/sys/uvm/uvm_init.c Tue Jan 29 21:37:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_init.c,v 1.44 2012/02/17 23:41:02 matt Exp $ */ +/* $NetBSD: uvm_init.c,v 1.45 2013/01/29 21:37:04 para Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uvm_init.c,v 1.44 2012/02/17 23:41:02 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_init.c,v 1.45 2013/01/29 21:37:04 para Exp $); #include sys/param.h #include sys/systm.h @@ -106,8 +106,8 @@ uvm_init(void) /* * Setup the kernel's virtual memory data structures. This includes - * setting up the kernel_map/kernel_object. Bootstrap all kernel - * memory allocators. + * setting up the kernel_map/kernel_object. + * Bootstrap all kernel memory allocators. */ uao_init(); @@ -128,9 +128,8 @@ uvm_init(void) pmap_init(); /* - * Init the kernel maps virtual address caches. Make kernel memory - * allocator ready for use. After this call the pool/kmem memory - * allocators can be used. + * Make kernel memory allocators ready for use. + * After this call the pool/kmem memory allocators can be used. */ uvm_km_init();
CVS commit: src/share/man/man9
Module Name:src Committed By: para Date: Tue Jan 29 21:55:07 UTC 2013 Modified Files: src/share/man/man9: vmem.9 Log Message: bring man page up to date for vmem_xcreate and the changed function signature of vmem_create To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/share/man/man9/vmem.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/vmem.9 diff -u src/share/man/man9/vmem.9:1.13 src/share/man/man9/vmem.9:1.14 --- src/share/man/man9/vmem.9:1.13 Mon Sep 5 18:21:29 2011 +++ src/share/man/man9/vmem.9 Tue Jan 29 21:55:07 2013 @@ -1,4 +1,4 @@ -.\ $NetBSD: vmem.9,v 1.13 2011/09/05 18:21:29 wiz Exp $ +.\ $NetBSD: vmem.9,v 1.14 2013/01/29 21:55:07 para Exp $ .\ .\ Copyright (c)2006 YAMAMOTO Takashi, .\ All rights reserved. @@ -39,6 +39,13 @@ .Ft vmem_t * .Fn vmem_create \ const char *name vmem_addr_t base vmem_size_t size vmem_size_t quantum \ +int (*allocfn)(void *, vmem_size_t, vm_flag_t, vmem_addr_t *) \ +void (*freefn)(void *, vmem_addr_t, vmem_size_t) \ +void *arg vmem_size_t qcache_max vm_flag_t flags int ipl +.\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +.Ft vmem_t * +.Fn vmem_xcreate \ +const char *name vmem_addr_t base vmem_size_t size vmem_size_t quantum \ int (*allocfn)(void *, vmem_size_t, vmem_size_t *, vm_flag_t, vmem_addr_t *) \ void (*freefn)(void *, vmem_addr_t, vmem_size_t) \ void *arg vmem_size_t qcache_max vm_flag_t flags int ipl @@ -105,6 +112,107 @@ calls .Fo (*allocfn) .Fa arg .Fa size +.Fa flags +.Fa \*[Am]addrp +.Fc +to import a span of size at least +.Fa size . +.Fa allocfn +should accept the same +.Fa flags +as +.Fn vmem_alloc . +.Fa allocfn +must return +.Dv ENOMEM +to indicate failure, or 0 on success. +If +.Fa allocfn +succeeds, it must write the starting address of the imported span to +.Fa addrp . +.It Fa freefn +The callback function used to free spans to the backend arena. +.Fa freefn +may be +.Dv NULL +even if +.Fa allocfn +is not +.Dv NULL . +.Nm +calls +.Fn (*freefn) arg addr size +to return to +.Fa arg +a span of size +.Fa size , +starting at +.Fa addr , +that was previously allocated by +.Fa allocfn . +.It Fa arg +The backend arena. +.Fa arg +may be +.Dv NULL . +.Nm +passes +.Fa arg +as the first argument of +.Fa allocfn +and +.Fa freefn . +.It Fa qcache_max +The largest size of allocations which can be served by quantum cache. +It is merely a hint and can be ignored. +.It Fa flags +Either of: +.Bl -tag -width VM_NOSLEEP +.It Dv VM_SLEEP +Can sleep until enough resources are available. +.It Dv VM_NOSLEEP +Don't sleep. +Immediately return +.Dv NULL +if there are not enough resources available. +.El +.It Fa ipl +Interrupt level to be blocked for allocating from vmem. +.El +.Pp +.\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +.Fn vmem_xcreate +creates a new vmem arena. +.Pp +.Bl -tag -width qcache_max +.It Fa name +The string to describe the vmem. +.It Fa base +The start address of the initial span. +Pass +.Dv 0 +if no initial span is required. +.It Fa size +The size of the initial span. +Pass +.Dv 0 +if no initial span is required. +.It Fa quantum +The smallest unit of allocation. +.It Fa allocfn +The callback function used to import spans from the backend arena. +Set both +.Fa allocfn +and +.Fa freefn +to +.Dv NULL +to disable automatic imports. +.Nm +calls +.Fo (*allocfn) +.Fa arg +.Fa size .Fa \*[Am]actualsize .Fa flags .Fa \*[Am]addrp
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Tue Jan 29 23:00:31 UTC 2013 Modified Files: src/sys/kern: kern_sysctl.c Log Message: fix the sysctl_setup_func typedef To generate a diff of this commit: cvs rdiff -u -r1.237 -r1.238 src/sys/kern/kern_sysctl.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/kern/kern_sysctl.c diff -u src/sys/kern/kern_sysctl.c:1.237 src/sys/kern/kern_sysctl.c:1.238 --- src/sys/kern/kern_sysctl.c:1.237 Tue Jan 29 19:56:43 2013 +++ src/sys/kern/kern_sysctl.c Tue Jan 29 23:00:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sysctl.c,v 1.237 2013/01/29 19:56:43 christos Exp $ */ +/* $NetBSD: kern_sysctl.c,v 1.238 2013/01/29 23:00:31 para Exp $ */ /*- * Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: kern_sysctl.c,v 1.237 2013/01/29 19:56:43 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: kern_sysctl.c,v 1.238 2013/01/29 23:00:31 para Exp $); #include opt_defcorename.h #include ksyms.h @@ -102,7 +102,7 @@ static int sysctl_cvt_out(struct lwp *, static int sysctl_log_add(struct sysctllog **, const struct sysctlnode *); static int sysctl_log_realloc(struct sysctllog *); -typedef void (*sysctl_setup_func)(struct sysctllog **); +typedef void sysctl_setup_func(struct sysctllog **); struct sysctllog { const struct sysctlnode *log_root;
CVS commit: src/sys
Module Name:src Committed By: para Date: Tue Jan 29 21:26:25 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c src/sys/rump/librump/rumpkern: vm.c src/sys/sys: vmem.h vmem_impl.h Log Message: make vmem(9) ready to be used early during bootstrap to replace extent(9) pass memory for vmem structs into the initialization function and do away with the static pool of vmem structs. remove special bootstrapping of the quantum cache pools of the kmem_va_arena as memory for pool_caches is allocated via pool_allocator_meta which is fully operational at this point. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.134 -r1.135 src/sys/rump/librump/rumpkern/vm.c cvs rdiff -u -r1.19 -r1.20 src/sys/sys/vmem.h cvs rdiff -u -r1.1 -r1.2 src/sys/sys/vmem_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Tue Jan 29 21:29:41 UTC 2013 Modified Files: src/sys/uvm: uvm_km.c Log Message: bring file up to date for previous vmem changes. To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 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.
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Tue Jan 29 21:37:04 UTC 2013 Modified Files: src/sys/uvm: uvm_init.c Log Message: improve on comments To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/uvm/uvm_init.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man9
Module Name:src Committed By: para Date: Tue Jan 29 21:55:07 UTC 2013 Modified Files: src/share/man/man9: vmem.9 Log Message: bring man page up to date for vmem_xcreate and the changed function signature of vmem_create To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/share/man/man9/vmem.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Tue Jan 29 23:00:31 UTC 2013 Modified Files: src/sys/kern: kern_sysctl.c Log Message: fix the sysctl_setup_func typedef To generate a diff of this commit: cvs rdiff -u -r1.237 -r1.238 src/sys/kern/kern_sysctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Jan 26 13:50:34 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c src/sys/rump/librump/rumpkern: vm.c src/sys/sys: vmem.h src/sys/uvm: uvm_km.c Added Files: src/sys/sys: vmem_impl.h Log Message: make vmem(9) ready to be used early during bootstrap to replace extent(9). pass memory for vmem structs into the initialization functions and do away with the static pools for this. factor out the vmem internal structures into a private header. remove special bootstrapping of the kmem_va_arena as all necessary memory comes from pool_allocator_meta wich is fully operational at this point. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.132 -r1.133 src/sys/rump/librump/rumpkern/vm.c cvs rdiff -u -r1.17 -r1.18 src/sys/sys/vmem.h cvs rdiff -u -r0 -r1.1 src/sys/sys/vmem_impl.h cvs rdiff -u -r1.135 -r1.136 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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.77 src/sys/kern/subr_vmem.c:1.78 --- src/sys/kern/subr_vmem.c:1.77 Fri Jan 4 08:28:38 2013 +++ src/sys/kern/subr_vmem.c Sat Jan 26 13:50:33 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.77 2013/01/04 08:28:38 para Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.78 2013/01/26 13:50:33 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.77 2013/01/04 08:28:38 para Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.78 2013/01/26 13:50:33 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -53,6 +53,7 @@ __KERNEL_RCSID(0, $NetBSD: subr_vmem.c, #include sys/kmem.h #include sys/pool.h #include sys/vmem.h +#include sys/vmem_impl.h #include sys/workqueue.h #include sys/atomic.h #include uvm/uvm.h @@ -61,7 +62,13 @@ __KERNEL_RCSID(0, $NetBSD: subr_vmem.c, #include uvm/uvm_page.h #include uvm/uvm_pdaemon.h #else /* defined(_KERNEL) */ +#include stdio.h +#include errno.h +#include assert.h +#include stdlib.h +#include string.h #include ../sys/vmem.h +#include ../sys/vmem_impl.h #endif /* defined(_KERNEL) */ @@ -78,28 +85,23 @@ VMEM_EVCNT_DEFINE(bt_pages) VMEM_EVCNT_DEFINE(bt_count) VMEM_EVCNT_DEFINE(bt_inuse) -#define LOCK_DECL(name) \ -kmutex_t name; char lockpad[COHERENCY_UNIT - sizeof(kmutex_t)] - -#define CONDVAR_DECL(name) \ -kcondvar_t name +#define VMEM_CONDVAR_INIT(vm, wchan) cv_init(vm-vm_cv, wchan) +#define VMEM_CONDVAR_DESTROY(vm) cv_destroy(vm-vm_cv) +#define VMEM_CONDVAR_WAIT(vm) cv_wait(vm-vm_cv, vm-vm_lock) +#define VMEM_CONDVAR_BROADCAST(vm) cv_broadcast(vm-vm_cv) #else /* defined(_KERNEL) */ -#include stdio.h -#include errno.h -#include assert.h -#include stdlib.h -#include string.h #define VMEM_EVCNT_INCR(ev) /* nothing */ #define VMEM_EVCNT_DECR(ev) /* nothing */ -#define UNITTEST -#define KASSERT(a) assert(a) -#define LOCK_DECL(name) /* nothing */ -#define CONDVAR_DECL(name) /* nothing */ #define VMEM_CONDVAR_INIT(vm, wchan) /* nothing */ +#define VMEM_CONDVAR_DESTROY(vm) /* nothing */ +#define VMEM_CONDVAR_WAIT(vm) /* nothing */ #define VMEM_CONDVAR_BROADCAST(vm) /* nothing */ + +#define UNITTEST +#define KASSERT(a) assert(a) #define mutex_init(a, b, c) /* nothing */ #define mutex_destroy(a) /* nothing */ #define mutex_enter(a) /* nothing */ @@ -110,74 +112,25 @@ VMEM_EVCNT_DEFINE(bt_inuse) #define panic(...) printf(__VA_ARGS__); abort() #endif /* defined(_KERNEL) */ -struct vmem; -struct vmem_btag; - #if defined(VMEM_SANITY) static void vmem_check(vmem_t *); #else /* defined(VMEM_SANITY) */ #define vmem_check(vm) /* nothing */ #endif /* defined(VMEM_SANITY) */ -#define VMEM_MAXORDER (sizeof(vmem_size_t) * CHAR_BIT) - #define VMEM_HASHSIZE_MIN 1 /* XXX */ #define VMEM_HASHSIZE_MAX 65536 /* XXX */ #define VMEM_HASHSIZE_INIT 1 #define VM_FITMASK (VM_BESTFIT | VM_INSTANTFIT) -CIRCLEQ_HEAD(vmem_seglist, vmem_btag); -LIST_HEAD(vmem_freelist, vmem_btag); -LIST_HEAD(vmem_hashlist, vmem_btag); - -#if defined(QCACHE) -#define VMEM_QCACHE_IDX_MAX 32 - -#define QC_NAME_MAX 16 - -struct qcache { - pool_cache_t qc_cache; - vmem_t *qc_vmem; - char qc_name[QC_NAME_MAX]; -}; -typedef struct qcache qcache_t; -#define QC_POOL_TO_QCACHE(pool) ((qcache_t *)(pool-pr_qcache)) -#endif /* defined(QCACHE) */ - -#define VMEM_NAME_MAX 16 - -/* vmem arena */ -struct vmem { - CONDVAR_DECL(vm_cv); - LOCK_DECL(vm_lock); - vm_flag_t vm_flags; - vmem_import_t *vm_importfn; - vmem_release_t *vm_releasefn; - size_t vm_nfreetags; - LIST_HEAD(, vmem_btag) vm_freetags; - void *vm_arg; - struct vmem_seglist vm_seglist; - struct vmem_freelist vm_freelist[VMEM_MAXORDER]; - size_t vm_hashsize; - size_t vm_nbusytag; - struct vmem_hashlist *vm_hashlist; - struct vmem_hashlist vm_hash0; - size_t
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Jan 26 15:18:01 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c src/sys/rump/librump/rumpkern: vm.c src/sys/sys: vmem.h src/sys/uvm: uvm_km.c Log Message: revert previous commit not yet fully functional, sorry To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.133 -r1.134 src/sys/rump/librump/rumpkern/vm.c cvs rdiff -u -r1.18 -r1.19 src/sys/sys/vmem.h cvs rdiff -u -r1.136 -r1.137 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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.78 src/sys/kern/subr_vmem.c:1.79 --- src/sys/kern/subr_vmem.c:1.78 Sat Jan 26 13:50:33 2013 +++ src/sys/kern/subr_vmem.c Sat Jan 26 15:18:00 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.78 2013/01/26 13:50:33 para Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.79 2013/01/26 15:18:00 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.78 2013/01/26 13:50:33 para Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.79 2013/01/26 15:18:00 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -53,7 +53,6 @@ __KERNEL_RCSID(0, $NetBSD: subr_vmem.c, #include sys/kmem.h #include sys/pool.h #include sys/vmem.h -#include sys/vmem_impl.h #include sys/workqueue.h #include sys/atomic.h #include uvm/uvm.h @@ -62,13 +61,7 @@ __KERNEL_RCSID(0, $NetBSD: subr_vmem.c, #include uvm/uvm_page.h #include uvm/uvm_pdaemon.h #else /* defined(_KERNEL) */ -#include stdio.h -#include errno.h -#include assert.h -#include stdlib.h -#include string.h #include ../sys/vmem.h -#include ../sys/vmem_impl.h #endif /* defined(_KERNEL) */ @@ -85,23 +78,28 @@ VMEM_EVCNT_DEFINE(bt_pages) VMEM_EVCNT_DEFINE(bt_count) VMEM_EVCNT_DEFINE(bt_inuse) -#define VMEM_CONDVAR_INIT(vm, wchan) cv_init(vm-vm_cv, wchan) -#define VMEM_CONDVAR_DESTROY(vm) cv_destroy(vm-vm_cv) -#define VMEM_CONDVAR_WAIT(vm) cv_wait(vm-vm_cv, vm-vm_lock) -#define VMEM_CONDVAR_BROADCAST(vm) cv_broadcast(vm-vm_cv) +#define LOCK_DECL(name) \ +kmutex_t name; char lockpad[COHERENCY_UNIT - sizeof(kmutex_t)] + +#define CONDVAR_DECL(name) \ +kcondvar_t name #else /* defined(_KERNEL) */ +#include stdio.h +#include errno.h +#include assert.h +#include stdlib.h +#include string.h #define VMEM_EVCNT_INCR(ev) /* nothing */ #define VMEM_EVCNT_DECR(ev) /* nothing */ -#define VMEM_CONDVAR_INIT(vm, wchan) /* nothing */ -#define VMEM_CONDVAR_DESTROY(vm) /* nothing */ -#define VMEM_CONDVAR_WAIT(vm) /* nothing */ -#define VMEM_CONDVAR_BROADCAST(vm) /* nothing */ - #define UNITTEST #define KASSERT(a) assert(a) +#define LOCK_DECL(name) /* nothing */ +#define CONDVAR_DECL(name) /* nothing */ +#define VMEM_CONDVAR_INIT(vm, wchan) /* nothing */ +#define VMEM_CONDVAR_BROADCAST(vm) /* nothing */ #define mutex_init(a, b, c) /* nothing */ #define mutex_destroy(a) /* nothing */ #define mutex_enter(a) /* nothing */ @@ -112,25 +110,74 @@ VMEM_EVCNT_DEFINE(bt_inuse) #define panic(...) printf(__VA_ARGS__); abort() #endif /* defined(_KERNEL) */ +struct vmem; +struct vmem_btag; + #if defined(VMEM_SANITY) static void vmem_check(vmem_t *); #else /* defined(VMEM_SANITY) */ #define vmem_check(vm) /* nothing */ #endif /* defined(VMEM_SANITY) */ +#define VMEM_MAXORDER (sizeof(vmem_size_t) * CHAR_BIT) + #define VMEM_HASHSIZE_MIN 1 /* XXX */ #define VMEM_HASHSIZE_MAX 65536 /* XXX */ #define VMEM_HASHSIZE_INIT 1 #define VM_FITMASK (VM_BESTFIT | VM_INSTANTFIT) -#if defined(_KERNEL) -static bool vmem_bootstrapped = false; -static kmutex_t vmem_list_lock; -static LIST_HEAD(, vmem) vmem_list = LIST_HEAD_INITIALIZER(vmem_list); -#endif /* defined(_KERNEL) */ +CIRCLEQ_HEAD(vmem_seglist, vmem_btag); +LIST_HEAD(vmem_freelist, vmem_btag); +LIST_HEAD(vmem_hashlist, vmem_btag); -/* misc */ +#if defined(QCACHE) +#define VMEM_QCACHE_IDX_MAX 32 + +#define QC_NAME_MAX 16 + +struct qcache { + pool_cache_t qc_cache; + vmem_t *qc_vmem; + char qc_name[QC_NAME_MAX]; +}; +typedef struct qcache qcache_t; +#define QC_POOL_TO_QCACHE(pool) ((qcache_t *)(pool-pr_qcache)) +#endif /* defined(QCACHE) */ + +#define VMEM_NAME_MAX 16 + +/* vmem arena */ +struct vmem { + CONDVAR_DECL(vm_cv); + LOCK_DECL(vm_lock); + vm_flag_t vm_flags; + vmem_import_t *vm_importfn; + vmem_release_t *vm_releasefn; + size_t vm_nfreetags; + LIST_HEAD(, vmem_btag) vm_freetags; + void *vm_arg; + struct vmem_seglist vm_seglist; + struct vmem_freelist vm_freelist[VMEM_MAXORDER]; + size_t vm_hashsize; + size_t vm_nbusytag; + struct vmem_hashlist *vm_hashlist; + struct vmem_hashlist vm_hash0; + size_t vm_quantum_mask; + int vm_quantum_shift; + size_t vm_size; + size_t vm_inuse; + char vm_name[VMEM_NAME_MAX+1]; + LIST_ENTRY(vmem) vm_alllist; + +#if
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Jan 26 13:50:34 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c src/sys/rump/librump/rumpkern: vm.c src/sys/sys: vmem.h src/sys/uvm: uvm_km.c Added Files: src/sys/sys: vmem_impl.h Log Message: make vmem(9) ready to be used early during bootstrap to replace extent(9). pass memory for vmem structs into the initialization functions and do away with the static pools for this. factor out the vmem internal structures into a private header. remove special bootstrapping of the kmem_va_arena as all necessary memory comes from pool_allocator_meta wich is fully operational at this point. To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.132 -r1.133 src/sys/rump/librump/rumpkern/vm.c cvs rdiff -u -r1.17 -r1.18 src/sys/sys/vmem.h cvs rdiff -u -r0 -r1.1 src/sys/sys/vmem_impl.h cvs rdiff -u -r1.135 -r1.136 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.
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Jan 26 15:18:01 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c src/sys/rump/librump/rumpkern: vm.c src/sys/sys: vmem.h src/sys/uvm: uvm_km.c Log Message: revert previous commit not yet fully functional, sorry To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.133 -r1.134 src/sys/rump/librump/rumpkern/vm.c cvs rdiff -u -r1.18 -r1.19 src/sys/sys/vmem.h cvs rdiff -u -r1.136 -r1.137 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.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Fri Jan 4 08:28:39 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c Log Message: fix a lock order reversal during global boundary tag refill. thanks to chuq@ xxx: request pullup To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/kern/subr_vmem.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.76 src/sys/kern/subr_vmem.c:1.77 --- src/sys/kern/subr_vmem.c:1.76 Thu Sep 13 21:44:50 2012 +++ src/sys/kern/subr_vmem.c Fri Jan 4 08:28:38 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.76 2012/09/13 21:44:50 joerg Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.77 2013/01/04 08:28:38 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.76 2012/09/13 21:44:50 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.77 2013/01/04 08:28:38 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -273,6 +273,7 @@ static int static_qc_pool_count = STATIC vmem_t *kmem_va_meta_arena; vmem_t *kmem_meta_arena; +static kmutex_t vmem_refill_lock; static kmutex_t vmem_btag_lock; static LIST_HEAD(, vmem_btag) vmem_btag_freelist; static size_t vmem_btag_freelist_count = 0; @@ -292,19 +293,26 @@ bt_refillglobal(vm_flag_t flags) bt_t *bt; int i; + mutex_enter(vmem_refill_lock); + mutex_enter(vmem_btag_lock); if (vmem_btag_freelist_count 0) { mutex_exit(vmem_btag_lock); + mutex_exit(vmem_refill_lock); return 0; + } else { + mutex_exit(vmem_btag_lock); } if (vmem_alloc(kmem_meta_arena, PAGE_SIZE, (flags ~VM_FITMASK) | VM_INSTANTFIT | VM_POPULATING, va) != 0) { mutex_exit(vmem_btag_lock); + mutex_exit(vmem_refill_lock); return ENOMEM; } VMEM_EVCNT_INCR(bt_pages); + mutex_enter(vmem_btag_lock); btp = (void *) va; for (i = 0; i (BT_PER_PAGE); i++) { bt = btp; @@ -318,9 +326,14 @@ bt_refillglobal(vm_flag_t flags) } mutex_exit(vmem_btag_lock); - bt_refill(kmem_arena, (flags ~VM_FITMASK) | VM_INSTANTFIT); - bt_refill(kmem_va_meta_arena, (flags ~VM_FITMASK) | VM_INSTANTFIT); - bt_refill(kmem_meta_arena, (flags ~VM_FITMASK) | VM_INSTANTFIT); + bt_refill(kmem_arena, (flags ~VM_FITMASK) + | VM_INSTANTFIT | VM_POPULATING); + bt_refill(kmem_va_meta_arena, (flags ~VM_FITMASK) + | VM_INSTANTFIT | VM_POPULATING); + bt_refill(kmem_meta_arena, (flags ~VM_FITMASK) + | VM_INSTANTFIT | VM_POPULATING); + + mutex_exit(vmem_refill_lock); return 0; } @@ -330,7 +343,9 @@ bt_refill(vmem_t *vm, vm_flag_t flags) { bt_t *bt; - bt_refillglobal(flags); + if (!(flags VM_POPULATING)) { + bt_refillglobal(flags); + } VMEM_LOCK(vm); mutex_enter(vmem_btag_lock); @@ -701,6 +716,7 @@ vmem_bootstrap(void) { mutex_init(vmem_list_lock, MUTEX_DEFAULT, IPL_VM); + mutex_init(vmem_refill_lock, MUTEX_DEFAULT, IPL_VM); mutex_init(vmem_btag_lock, MUTEX_DEFAULT, IPL_VM); while (static_bt_count-- 0) {
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Fri Jan 4 08:28:39 UTC 2013 Modified Files: src/sys/kern: subr_vmem.c Log Message: fix a lock order reversal during global boundary tag refill. thanks to chuq@ xxx: request pullup To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/top/dist/machine
Module Name:src Committed By: para Date: Thu Jan 3 10:12:36 UTC 2013 Modified Files: src/external/bsd/top/dist/machine: m_netbsd.c Log Message: explicitly include sys/resource.h To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/external/bsd/top/dist/machine/m_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/top/dist/machine/m_netbsd.c diff -u src/external/bsd/top/dist/machine/m_netbsd.c:1.16 src/external/bsd/top/dist/machine/m_netbsd.c:1.17 --- src/external/bsd/top/dist/machine/m_netbsd.c:1.16 Sat Oct 8 08:45:37 2011 +++ src/external/bsd/top/dist/machine/m_netbsd.c Thu Jan 3 10:12:36 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $ */ +/* $NetBSD: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $ */ /* * top - a top users display for Unix @@ -37,15 +37,16 @@ * Andrew Doran a...@netbsd.org * * - * $Id: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $ + * $Id: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $ */ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: m_netbsd.c,v 1.16 2011/10/08 08:45:37 njoly Exp $); +__RCSID($NetBSD: m_netbsd.c,v 1.17 2013/01/03 10:12:36 para Exp $); #endif #include sys/param.h +#include sys/resource.h #include sys/sysctl.h #include sys/sched.h #include sys/swap.h
CVS commit: src/external/bsd/top/dist/machine
Module Name:src Committed By: para Date: Thu Jan 3 10:12:36 UTC 2013 Modified Files: src/external/bsd/top/dist/machine: m_netbsd.c Log Message: explicitly include sys/resource.h To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/external/bsd/top/dist/machine/m_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Mon Nov 5 21:35:28 UTC 2012 Modified Files: src/sys/kern: vfs_lookup.c Log Message: make DEBUG kernels buildable again (typo) To generate a diff of this commit: cvs rdiff -u -r1.198 -r1.199 src/sys/kern/vfs_lookup.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/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.198 src/sys/kern/vfs_lookup.c:1.199 --- src/sys/kern/vfs_lookup.c:1.198 Mon Nov 5 19:06:26 2012 +++ src/sys/kern/vfs_lookup.c Mon Nov 5 21:35:28 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.198 2012/11/05 19:06:26 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.199 2012/11/05 21:35:28 para Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.198 2012/11/05 19:06:26 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: vfs_lookup.c,v 1.199 2012/11/05 21:35:28 para Exp $); #include opt_magiclinks.h @@ -1696,7 +1696,7 @@ relookup(struct vnode *dvp, struct vnode if ((uint32_t)newhash != (uint32_t)cnp-cn_hash) panic(relookup: bad hash); #endif - newlen = nami_getcomponent(cnp-cn_nameptr); + newlen = namei_getcomponent(cnp-cn_nameptr); if (cnp-cn_namelen != newlen) panic(relookup: bad len); cp = cnp-cn_nameptr + cnp-cn_namelen;
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Mon Nov 5 21:35:28 UTC 2012 Modified Files: src/sys/kern: vfs_lookup.c Log Message: make DEBUG kernels buildable again (typo) To generate a diff of this commit: cvs rdiff -u -r1.198 -r1.199 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: para Date: Mon Oct 29 16:00:05 UTC 2012 Modified Files: src/sys/uvm: uvm_map.c uvm_map.h src/usr.bin/pmap: pmap.c Log Message: get rid of not used uvm_map flag (UVM_MAP_KMAPENT) To generate a diff of this commit: cvs rdiff -u -r1.322 -r1.323 src/sys/uvm/uvm_map.c cvs rdiff -u -r1.71 -r1.72 src/sys/uvm/uvm_map.h cvs rdiff -u -r1.49 -r1.50 src/usr.bin/pmap/pmap.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_map.c diff -u src/sys/uvm/uvm_map.c:1.322 src/sys/uvm/uvm_map.c:1.323 --- src/sys/uvm/uvm_map.c:1.322 Tue Sep 4 13:37:42 2012 +++ src/sys/uvm/uvm_map.c Mon Oct 29 16:00:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.322 2012/09/04 13:37:42 matt Exp $ */ +/* $NetBSD: uvm_map.c,v 1.323 2012/10/29 16:00:05 para Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.322 2012/09/04 13:37:42 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_map.c,v 1.323 2012/10/29 16:00:05 para Exp $); #include opt_ddb.h #include opt_uvmhist.h @@ -2221,10 +2221,7 @@ uvm_unmap_remove(struct vm_map *map, vad */ KASSERT(vm_map_pmap(map) == pmap_kernel()); - if ((entry-flags UVM_MAP_KMAPENT) == 0) { -uvm_km_pgremove_intrsafe(map, entry-start, -entry-end); - } + uvm_km_pgremove_intrsafe(map, entry-start, entry-end); } else if (UVM_ET_ISOBJ(entry) UVM_OBJ_IS_KERN_OBJECT(entry-object.uvm_obj)) { panic(%s: kernel object %p %p\n, @@ -2242,26 +2239,23 @@ uvm_unmap_remove(struct vm_map *map, vad } #if defined(DEBUG) - if ((entry-flags UVM_MAP_KMAPENT) == 0) { - - /* - * check if there's remaining mapping, - * which is a bug in caller. - */ + /* + * check if there's remaining mapping, + * which is a bug in caller. + */ - vaddr_t va; - for (va = entry-start; va entry-end; - va += PAGE_SIZE) { -if (pmap_extract(vm_map_pmap(map), va, NULL)) { - panic(%s: %#PRIxVADDR has mapping, - __func__, va); -} + vaddr_t va; + for (va = entry-start; va entry-end; + va += PAGE_SIZE) { + if (pmap_extract(vm_map_pmap(map), va, NULL)) { +panic(%s: %#PRIxVADDR has mapping, +__func__, va); } + } - if (VM_MAP_IS_KERNEL(map)) { -uvm_km_check_empty(map, entry-start, -entry-end); - } + if (VM_MAP_IS_KERNEL(map)) { + uvm_km_check_empty(map, entry-start, + entry-end); } #endif /* defined(DEBUG) */ Index: src/sys/uvm/uvm_map.h diff -u src/sys/uvm/uvm_map.h:1.71 src/sys/uvm/uvm_map.h:1.72 --- src/sys/uvm/uvm_map.h:1.71 Sun Feb 19 00:05:56 2012 +++ src/sys/uvm/uvm_map.h Mon Oct 29 16:00:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.h,v 1.71 2012/02/19 00:05:56 rmind Exp $ */ +/* $NetBSD: uvm_map.h,v 1.72 2012/10/29 16:00:05 para Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -150,7 +150,6 @@ struct vm_map_entry { u_int8_t flags; /* flags */ #define UVM_MAP_KERNEL 0x01 /* kernel map entry */ -#define UVM_MAP_KMAPENT 0x02 /* contains map entries */ #define UVM_MAP_STATIC 0x04 /* special static entries */ #define UVM_MAP_NOMERGE 0x08 /* this entry is not mergable */ Index: src/usr.bin/pmap/pmap.c diff -u src/usr.bin/pmap/pmap.c:1.49 src/usr.bin/pmap/pmap.c:1.50 --- src/usr.bin/pmap/pmap.c:1.49 Sun Feb 19 02:47:53 2012 +++ src/usr.bin/pmap/pmap.c Mon Oct 29 16:00:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.49 2012/02/19 02:47:53 rmind Exp $ */ +/* $NetBSD: pmap.c,v 1.50 2012/10/29 16:00:05 para Exp $ */ /* * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: pmap.c,v 1.49 2012/02/19 02:47:53 rmind Exp $); +__RCSID($NetBSD: pmap.c,v 1.50 2012/10/29 16:00:05 para Exp $); #endif #include string.h @@ -304,7 +304,6 @@ dump_vm_map_entry(kvm_t *kd, struct kinf printf(%*sflags = %x %s%s%s%s }\n, indent(2), , vme-flags, vme-flags UVM_MAP_KERNEL ? KERNEL : , - vme-flags UVM_MAP_KMAPENT ? KMAPENT : , vme-flags UVM_MAP_STATIC ? STATIC : , vme-flags UVM_MAP_NOMERGE ? NOMERGE : ); }
CVS commit: src/usr.bin/pmap
Module Name:src Committed By: para Date: Mon Oct 29 16:25:27 UTC 2012 Modified Files: src/usr.bin/pmap: pmap.c Log Message: fix format string To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/usr.bin/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/pmap/pmap.c diff -u src/usr.bin/pmap/pmap.c:1.50 src/usr.bin/pmap/pmap.c:1.51 --- src/usr.bin/pmap/pmap.c:1.50 Mon Oct 29 16:00:05 2012 +++ src/usr.bin/pmap/pmap.c Mon Oct 29 16:25:25 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.50 2012/10/29 16:00:05 para Exp $ */ +/* $NetBSD: pmap.c,v 1.51 2012/10/29 16:25:25 para Exp $ */ /* * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: pmap.c,v 1.50 2012/10/29 16:00:05 para Exp $); +__RCSID($NetBSD: pmap.c,v 1.51 2012/10/29 16:25:25 para Exp $); #endif #include string.h @@ -301,7 +301,7 @@ dump_vm_map_entry(kvm_t *kd, struct kinf printf(%*saref = { ar_pageoff = %x, ar_amap = %p },, indent(2), , vme-aref.ar_pageoff, vme-aref.ar_amap); printf( advice = %d,\n, vme-advice); - printf(%*sflags = %x %s%s%s%s }\n, indent(2), , + printf(%*sflags = %x %s%s%s }\n, indent(2), , vme-flags, vme-flags UVM_MAP_KERNEL ? KERNEL : , vme-flags UVM_MAP_STATIC ? STATIC : ,
CVS commit: src
Module Name:src Committed By: para Date: Mon Oct 29 16:00:05 UTC 2012 Modified Files: src/sys/uvm: uvm_map.c uvm_map.h src/usr.bin/pmap: pmap.c Log Message: get rid of not used uvm_map flag (UVM_MAP_KMAPENT) To generate a diff of this commit: cvs rdiff -u -r1.322 -r1.323 src/sys/uvm/uvm_map.c cvs rdiff -u -r1.71 -r1.72 src/sys/uvm/uvm_map.h cvs rdiff -u -r1.49 -r1.50 src/usr.bin/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/pmap
Module Name:src Committed By: para Date: Mon Oct 29 16:25:27 UTC 2012 Modified Files: src/usr.bin/pmap: pmap.c Log Message: fix format string To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/usr.bin/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Thu Oct 18 19:33:38 UTC 2012 Modified Files: src/sys/kern: uipc_mbuf.c Log Message: bring comment up to reality kmem_map = kmem_arena To generate a diff of this commit: cvs rdiff -u -r1.146 -r1.147 src/sys/kern/uipc_mbuf.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/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.146 src/sys/kern/uipc_mbuf.c:1.147 --- src/sys/kern/uipc_mbuf.c:1.146 Sun Apr 29 16:36:53 2012 +++ src/sys/kern/uipc_mbuf.c Thu Oct 18 19:33:38 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_mbuf.c,v 1.146 2012/04/29 16:36:53 dsl Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.147 2012/10/18 19:33:38 para Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uipc_mbuf.c,v 1.146 2012/04/29 16:36:53 dsl Exp $); +__KERNEL_RCSID(0, $NetBSD: uipc_mbuf.c,v 1.147 2012/10/18 19:33:38 para Exp $); #include opt_mbuftrace.h #include opt_nmbclusters.h @@ -150,7 +150,7 @@ static int nmbclusters_limit(void) { #if defined(PMAP_MAP_POOLPAGE) - /* direct mapping, doesn't use space in kmem_map */ + /* direct mapping, doesn't use space in kmem_arena */ vsize_t max_size = physmem / 4; #else vsize_t max_size = MIN(physmem / 4, nkmempages / 4);
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Thu Oct 18 19:33:38 UTC 2012 Modified Files: src/sys/kern: uipc_mbuf.c Log Message: bring comment up to reality kmem_map = kmem_arena To generate a diff of this commit: cvs rdiff -u -r1.146 -r1.147 src/sys/kern/uipc_mbuf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Fri Sep 7 06:45:05 UTC 2012 Modified Files: src/sys/uvm: uvm_km.c Log Message: call pmap_growkernel once after the kmem_arena is created to make the pmap cover it's address space assert on the growth in uvm_km_kmem_alloc for the 3rd uvm_map_entry uvm_map_prepare will grow the kernel, but we might call into uvm_km_kmem_alloc through imports to the kmem_meta_arena earlier while here guard uvm_km_va_starved_p from kmem_arena not yet created thanks for tracking this down to everyone involved To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 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_km.c diff -u src/sys/uvm/uvm_km.c:1.134 src/sys/uvm/uvm_km.c:1.135 --- src/sys/uvm/uvm_km.c:1.134 Tue Sep 4 13:37:41 2012 +++ src/sys/uvm/uvm_km.c Fri Sep 7 06:45:04 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.134 2012/09/04 13:37:41 matt Exp $ */ +/* $NetBSD: uvm_km.c,v 1.135 2012/09/07 06:45:04 para 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.134 2012/09/04 13:37:41 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.135 2012/09/07 06:45:04 para Exp $); #include opt_uvmhist.h @@ -202,7 +202,7 @@ int nkmempages = 0; vaddr_t kmembase; vsize_t kmemsize; -vmem_t *kmem_arena; +vmem_t *kmem_arena = NULL; vmem_t *kmem_va_arena; /* @@ -329,6 +329,18 @@ uvm_km_bootstrap(vaddr_t start, vaddr_t kmem_arena = vmem_create(kmem, kmembase, kmemsize, PAGE_SIZE, NULL, NULL, NULL, 0, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM); +#ifdef PMAP_GROWKERNEL + /* + * kmem_arena VA allocations happen independently of uvm_map. + * grow kernel to accommodate the kmem_arena. + */ + if (uvm_maxkaddr kmembase + kmemsize) { + uvm_maxkaddr = pmap_growkernel(kmembase + kmemsize); + KASSERTMSG(uvm_maxkaddr = kmembase + kmemsize, + %#PRIxVADDR %#PRIxVADDR %#PRIxVSIZE, + uvm_maxkaddr, kmembase, kmemsize); + } +#endif vmem_init(kmem_arena); @@ -782,18 +794,12 @@ again: #ifdef PMAP_GROWKERNEL /* - * These VA allocations happen independently of uvm_map so if this allocation - * extends beyond the current limit, then allocate more resources for it. - * This can only happen while the kmem_map is the only map entry in the - * kernel_map because as soon as another map entry is created, uvm_map_prepare - * will set uvm_maxkaddr to an address beyond the kmem_map. - */ - if (uvm_maxkaddr va + size) { - uvm_maxkaddr = pmap_growkernel(va + size); - KASSERTMSG(uvm_maxkaddr = va + size, - %#PRIxVADDR %#PRIxPTR %#zx, - uvm_maxkaddr, va, size); - } + * These VA allocations happen independently of uvm_map + * so this allocation must not extend beyond the current limit. + */ + KASSERTMSG(uvm_maxkaddr = va + size, + %#PRIxVADDR %#PRIxPTR %#zx, + uvm_maxkaddr, va, size); #endif loopva = va; @@ -864,6 +870,9 @@ uvm_km_va_starved_p(void) vmem_size_t total; vmem_size_t free; + if (kmem_arena == NULL) + return false; + total = vmem_size(kmem_arena, VMEM_ALLOC|VMEM_FREE); free = vmem_size(kmem_arena, VMEM_FREE);
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Fri Sep 7 06:45:05 UTC 2012 Modified Files: src/sys/uvm: uvm_km.c Log Message: call pmap_growkernel once after the kmem_arena is created to make the pmap cover it's address space assert on the growth in uvm_km_kmem_alloc for the 3rd uvm_map_entry uvm_map_prepare will grow the kernel, but we might call into uvm_km_kmem_alloc through imports to the kmem_meta_arena earlier while here guard uvm_km_va_starved_p from kmem_arena not yet created thanks for tracking this down to everyone involved To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 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.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sat Sep 1 12:28:59 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: rework boundary-tag reserve calculation, make it more precise. add comment about the rational behind the sizing of certain vars used by allocation and bootstrap. as requested by yamt@ To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/kern/subr_vmem.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.74 src/sys/kern/subr_vmem.c:1.75 --- src/sys/kern/subr_vmem.c:1.74 Mon Jul 30 17:49:24 2012 +++ src/sys/kern/subr_vmem.c Sat Sep 1 12:28:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.74 2012/07/30 17:49:24 njoly Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.75 2012/09/01 12:28:58 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.74 2012/07/30 17:49:24 njoly Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.75 2012/09/01 12:28:58 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -241,13 +241,23 @@ static LIST_HEAD(, vmem) vmem_list = LIS #else /* defined(_KERNEL) */ #define xmalloc(sz, flags) \ -kmem_alloc(sz, ((flags) VM_SLEEP) ? KM_SLEEP : KM_NOSLEEP); -#define xfree(p, sz) kmem_free(p, sz); +kmem_intr_alloc(sz, ((flags) VM_SLEEP) ? KM_SLEEP : KM_NOSLEEP); +#define xfree(p, sz) kmem_intr_free(p, sz); -#define BT_MINRESERVE 6 -#define BT_MAXFREE 64 -#define STATIC_VMEM_COUNT 5 +/* + * Memory for arenas initialized during bootstrap. + * There is memory for STATIC_VMEM_COUNT bootstrap arenas. + * + * BT_RESERVE calculation: + * we allocate memory for boundry tags with vmem, therefor we have + * to keep a reserve of bts used to allocated memory for bts. + * This reserve is 4 for each arena involved in allocating vmems memory. + * BT_MAXFREE: don't cache excessive counts of bts in arenas + */ +#define STATIC_VMEM_COUNT 4 #define STATIC_BT_COUNT 200 +#define BT_MINRESERVE 4 +#define BT_MAXFREE 64 /* must be equal or greater then qcache multiplier for kmem_va_arena */ #define STATIC_QC_POOL_COUNT 8 @@ -283,7 +293,7 @@ bt_refillglobal(vm_flag_t flags) int i; mutex_enter(vmem_btag_lock); - if (vmem_btag_freelist_count (BT_MINRESERVE * 16)) { + if (vmem_btag_freelist_count 0) { mutex_exit(vmem_btag_lock); return 0; } @@ -325,7 +335,7 @@ bt_refill(vmem_t *vm, vm_flag_t flags) VMEM_LOCK(vm); mutex_enter(vmem_btag_lock); while (!LIST_EMPTY(vmem_btag_freelist) - vm-vm_nfreetags (BT_MINRESERVE * 2)) { + vm-vm_nfreetags = BT_MINRESERVE) { bt = LIST_FIRST(vmem_btag_freelist); LIST_REMOVE(bt, bt_freelist); LIST_INSERT_HEAD(vm-vm_freetags, bt, bt_freelist); @@ -349,7 +359,7 @@ bt_alloc(vmem_t *vm, vm_flag_t flags) bt_t *bt; again: VMEM_LOCK(vm); - if (vm-vm_nfreetags BT_MINRESERVE + if (vm-vm_nfreetags = BT_MINRESERVE (flags VM_POPULATING) == 0) { VMEM_UNLOCK(vm); if (bt_refill(vm, VM_NOSLEEP | VM_INSTANTFIT)) {
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sat Sep 1 12:28:59 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: rework boundary-tag reserve calculation, make it more precise. add comment about the rational behind the sizing of certain vars used by allocation and bootstrap. as requested by yamt@ To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sat Jul 21 11:45:04 UTC 2012 Modified Files: src/sys/kern: subr_kmem.c Log Message: split allocation lookup table to decrease overall memory used making allocator more flexible for allocations larger then 4kb move the encoded size under DEBUG back to the begining of allocated chunk no objections on tech-kern@ To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/kern/subr_kmem.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/kern/subr_kmem.c diff -u src/sys/kern/subr_kmem.c:1.45 src/sys/kern/subr_kmem.c:1.46 --- src/sys/kern/subr_kmem.c:1.45 Sun Apr 15 19:07:40 2012 +++ src/sys/kern/subr_kmem.c Sat Jul 21 11:45:04 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kmem.c,v 1.45 2012/04/15 19:07:40 martin Exp $ */ +/* $NetBSD: subr_kmem.c,v 1.46 2012/07/21 11:45:04 para Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.45 2012/04/15 19:07:40 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.46 2012/07/21 11:45:04 para Exp $); #include sys/param.h #include sys/callback.h @@ -77,10 +77,12 @@ __KERNEL_RCSID(0, $NetBSD: subr_kmem.c, #include lib/libkern/libkern.h -static const struct kmem_cache_info { +struct kmem_cache_info { size_t kc_size; const char * kc_name; -} kmem_cache_sizes[] = { +}; + +static const struct kmem_cache_info kmem_cache_sizes[] = { { 8, kmem-8 }, { 16, kmem-16 }, { 24, kmem-24 }, @@ -103,24 +105,39 @@ static const struct kmem_cache_info { { 512, kmem-512 }, { 768, kmem-768 }, { 1024, kmem-1024 }, + { 0, NULL } +}; + +static const struct kmem_cache_info kmem_cache_big_sizes[] = { { 2048, kmem-2048 }, { 4096, kmem-4096 }, + { 8192, kmem-8192 }, + { 16384, kmem-16384 }, { 0, NULL } }; /* * KMEM_ALIGN is the smallest guaranteed alignment and also the - * smallest allocateable quantum. Every cache size is a multiply - * of CACHE_LINE_SIZE and gets CACHE_LINE_SIZE alignment. + * smallest allocateable quantum. + * Every cache size = CACHE_LINE_SIZE gets CACHE_LINE_SIZE alignment. */ #define KMEM_ALIGN 8 #define KMEM_SHIFT 3 -#define KMEM_MAXSIZE 4096 +#define KMEM_MAXSIZE 1024 #define KMEM_CACHE_COUNT (KMEM_MAXSIZE KMEM_SHIFT) static pool_cache_t kmem_cache[KMEM_CACHE_COUNT] __cacheline_aligned; static size_t kmem_cache_maxidx __read_mostly; +#define KMEM_BIG_ALIGN 2048 +#define KMEM_BIG_SHIFT 11 +#define KMEM_BIG_MAXSIZE 16384 +#define KMEM_CACHE_BIG_COUNT (KMEM_BIG_MAXSIZE KMEM_BIG_SHIFT) + +static pool_cache_t kmem_cache_big[KMEM_CACHE_BIG_COUNT] __cacheline_aligned; +static size_t kmem_cache_big_maxidx __read_mostly; + + #if defined(DEBUG) defined(_HARDKERNEL) #ifndef KMEM_GUARD_DEPTH #define KMEM_GUARD_DEPTH 0 @@ -163,6 +180,10 @@ static void kmem_size_check(void *, size CTASSERT(KM_SLEEP == PR_WAITOK); CTASSERT(KM_NOSLEEP == PR_NOWAIT); +/* + * kmem_intr_alloc: allocate wired memory. + */ + void * kmem_intr_alloc(size_t size, km_flag_t kmflags) { @@ -178,28 +199,41 @@ kmem_intr_alloc(size_t size, km_flag_t k (kmflags KM_SLEEP) != 0); } #endif - allocsz = kmem_roundup_size(size) + REDZONE_SIZE + SIZE_SIZE; - index = (allocsz - 1) KMEM_SHIFT; + size = kmem_roundup_size(size); + allocsz = size + REDZONE_SIZE + SIZE_SIZE; - if (index = kmem_cache_maxidx) { + if ((index = ((allocsz -1) KMEM_SHIFT)) + kmem_cache_maxidx) { + pc = kmem_cache[index]; + } else if ((index = ((allocsz - 1) KMEM_BIG_SHIFT)) + kmem_cache_big_maxidx) { + pc = kmem_cache_big[index]; + } else { int ret = uvm_km_kmem_alloc(kmem_va_arena, (vsize_t)round_page(size), ((kmflags KM_SLEEP) ? VM_SLEEP : VM_NOSLEEP) | VM_INSTANTFIT, (vmem_addr_t *)p); - return ret ? NULL : p; + if (ret) { + return NULL; + } + FREECHECK_OUT(kmem_freecheck, p); + return p; } - pc = kmem_cache[index]; p = pool_cache_get(pc, kmflags); if (__predict_true(p != NULL)) { - kmem_poison_check(p, kmem_roundup_size(size)); + kmem_poison_check(p, size); FREECHECK_OUT(kmem_freecheck, p); - kmem_size_set(p, allocsz); + kmem_size_set(p, size); } - return p; + return p + SIZE_SIZE; } +/* + * kmem_intr_zalloc: allocate zeroed wired memory. + */ + void * kmem_intr_zalloc(size_t size, km_flag_t kmflags) { @@ -212,6 +246,10 @@ kmem_intr_zalloc(size_t size, km_flag_t return p; } +/* + * kmem_intr_free: free wired memory allocated by kmem_alloc. + */ + void kmem_intr_free(void *p, size_t size) { @@ -227,22 +265,30 @@ kmem_intr_free(void *p, size_t size) return; } #endif - allocsz = kmem_roundup_size(size) + REDZONE_SIZE + SIZE_SIZE; - index = (allocsz - 1) KMEM_SHIFT; + size = kmem_roundup_size(size); + allocsz = size + REDZONE_SIZE + SIZE_SIZE; - if (index = kmem_cache_maxidx) { + if ((index = ((allocsz -1)
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sat Jul 21 11:45:04 UTC 2012 Modified Files: src/sys/kern: subr_kmem.c Log Message: split allocation lookup table to decrease overall memory used making allocator more flexible for allocations larger then 4kb move the encoded size under DEBUG back to the begining of allocated chunk no objections on tech-kern@ To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/kern/subr_kmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Sat Jun 2 08:42:37 UTC 2012 Modified Files: src/sys/uvm: uvm_km.c Log Message: add some description about the vmem arenas, how they stack up and their purpose To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 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_km.c diff -u src/sys/uvm/uvm_km.c:1.125 src/sys/uvm/uvm_km.c:1.126 --- src/sys/uvm/uvm_km.c:1.125 Fri Apr 13 15:34:42 2012 +++ src/sys/uvm/uvm_km.c Sat Jun 2 08:42:37 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.125 2012/04/13 15:34:42 yamt Exp $ */ +/* $NetBSD: uvm_km.c,v 1.126 2012/06/02 08:42:37 para Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -83,11 +83,15 @@ * up the locking and protection of the kernel address space into smaller * chunks. * - * the vm system has several standard kernel submaps, including: + * the vm system has several standard kernel submaps/arenas, including: + * kmem_arena = used for kmem/pool (memoryallocators(9)) * pager_map = used to map buf structures into kernel space * exec_map = used during exec to handle exec args * etc... * + * the kmem_arena is a special submap, as it lives a fixed map entry + * within the kernel_map and controlled by vmem(9). + * * the kernel allocates its private memory out of special uvm_objects whose * reference count is set to UVM_OBJ_KERN (thus indicating that the objects * are special and never die). all kernel objects should be thought of @@ -117,10 +121,30 @@ * freed right away. this is done with the uvm_km_pgremove() function. * this has to be done because there is no backing store for kernel pages * and no need to save them after they are no longer referenced. + * + * kmem_arena: main arena controlling the kernel kva used by other arenas. + * kmem_va_arena: it utilizes quantum caching for fast allocations and to + * lower fragmentation. the pool and kmem allocate from this arena + * except for some pool meta-data. + * + * arenas for metadata allocations used by vmem(9) and pool(9) + * note: these arenas can't use quantum caching, the kmem_va_meta_arena + * compensates for this by importing larger chunks from kmem_arena. + * + * kmem_va_meta_arena: space for metadata is allocated from this arena. + * kmem_meta_arena: imports from kmem_va_meta_arena. + * allocations from this arena are backed with vm_pages. + * + * arena stacking: + * kmem_arena + * kmem_va_arena + * kmem_va_meta_arena + * kmem_meta_arena + * */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.125 2012/04/13 15:34:42 yamt Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.126 2012/06/02 08:42:37 para Exp $); #include opt_uvmhist.h
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Sat Jun 2 08:42:37 UTC 2012 Modified Files: src/sys/uvm: uvm_km.c Log Message: add some description about the vmem arenas, how they stack up and their purpose To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.126 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.
CVS commit: src/usr.bin/vmstat
Module Name:src Committed By: para Date: Sun Apr 29 16:23:56 UTC 2012 Modified Files: src/usr.bin/vmstat: vmstat.c Log Message: remove malloc(9) output function from vmstat it is not required and working any more To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/usr.bin/vmstat/vmstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/vmstat/vmstat.c diff -u src/usr.bin/vmstat/vmstat.c:1.187 src/usr.bin/vmstat/vmstat.c:1.188 --- src/usr.bin/vmstat/vmstat.c:1.187 Tue Mar 20 20:34:59 2012 +++ src/usr.bin/vmstat/vmstat.c Sun Apr 29 16:23:56 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vmstat.c,v 1.187 2012/03/20 20:34:59 matt Exp $ */ +/* $NetBSD: vmstat.c,v 1.188 2012/04/29 16:23:56 para Exp $ */ /*- * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19 #if 0 static char sccsid[] = @(#)vmstat.c 8.2 (Berkeley) 3/1/95; #else -__RCSID($NetBSD: vmstat.c,v 1.187 2012/03/20 20:34:59 matt Exp $); +__RCSID($NetBSD: vmstat.c,v 1.188 2012/04/29 16:23:56 para Exp $); #endif #endif /* not lint */ @@ -161,23 +161,19 @@ struct nlist namelist[] = { .n_name = _stathz }, #define X_NCHSTATS 3 { .n_name = _nchstats }, -#define X_KMEMSTAT 4 - { .n_name = _kmemstatistics }, -#define X_KMEMBUCKETS 5 - { .n_name = _kmembuckets }, -#define X_ALLEVENTS 6 +#define X_ALLEVENTS 4 { .n_name = _allevents }, -#define X_POOLHEAD 7 +#define X_POOLHEAD 5 { .n_name = _pool_head }, -#define X_UVMEXP 8 +#define X_UVMEXP 6 { .n_name = _uvmexp }, -#define X_TIME_SECOND 9 +#define X_TIME_SECOND 7 { .n_name = _time_second }, -#define X_TIME 10 +#define X_TIME 8 { .n_name = _time }, -#define X_CPU_QUEUE 11 +#define X_CPU_QUEUE 9 { .n_name = _cpu_queue }, -#define X_NL_SIZE 12 +#define X_NL_SIZE 10 { .n_name = NULL }, }; @@ -302,7 +298,6 @@ void drvstats(int *); void doevcnt(int verbose, int type); void dohashstat(int, int, const char *); void dointr(int verbose); -void domem(void); void dopool(int, int); void dopoolcache(int); void dosum(void); @@ -494,7 +489,6 @@ main(int argc, char *argv[]) (void)putchar('\n'); } if (todo MEMSTAT) { -domem(); dopool(verbose, wide); (void)putchar('\n'); } @@ -1226,119 +1220,6 @@ doevcnt(int verbose, int type) Total, counttotal, counttotal / uptime); } -static char memname[64]; - -void -domem(void) -{ - struct kmembuckets *kp; - struct malloc_type ks, *ksp; - int i, j; - int len, size, first; - long totuse = 0, totfree = 0, totreq = 0; - struct kmembuckets buckets[MINBUCKET + 16]; - - kread(namelist, X_KMEMBUCKETS, buckets, sizeof(buckets)); - for (first = 1, i = MINBUCKET, kp = buckets[i]; i MINBUCKET + 16; - i++, kp++) { - if (kp-kb_calls == 0) - continue; - if (first) { - (void)printf(Memory statistics by bucket size\n); - (void)printf( - Size In Use Free Requests HighWater Couldfree\n); - first = 0; - } - size = 1 i; - (void)printf(%8d %8ld %6ld %10ld %7ld %10ld\n, size, - kp-kb_total - kp-kb_totalfree, - kp-kb_totalfree, kp-kb_calls, - kp-kb_highwat, kp-kb_couldfree); - totfree += size * kp-kb_totalfree; - } - - /* - * If kmem statistics are not being gathered by the kernel, - * first will still be 1. - */ - if (first) { - warnx(Kmem statistics are not being gathered by the kernel.); - return; - } - - (void)printf(\nMemory usage type by bucket size\n); - (void)printf(Size Type(s)\n); - kp = buckets[MINBUCKET]; - for (j = 1 MINBUCKET; j 1 (MINBUCKET + 16); j = 1, kp++) { - if (kp-kb_calls == 0) - continue; - first = 1; - len = 8; - for (kread(namelist, X_KMEMSTAT, ksp, sizeof(ksp)); - ksp != NULL; ksp = ks.ks_next) { - deref_kptr(ksp, ks, sizeof(ks), malloc type); - if (ks.ks_calls == 0) -continue; - if ((ks.ks_size j) == 0) -continue; - deref_kptr(ks.ks_shortdesc, memname, - sizeof(memname), malloc type name); - len += 2 + strlen(memname); - if (first) -(void)printf(%8d %s, j, memname); - else -(void)printf(,); - if (len = 80) { -(void)printf(\n\t ); -len = 10 + strlen(memname); - } - if (!first) -(void)printf( %s, memname); - first = 0; - } - (void)putchar('\n'); - } - - (void)printf( - \nMemory statistics by typeType Kern\n); - (void)printf( - Type InUse MemUse HighUse Limit Requests Limit Limit Size(s)\n); - for (kread(namelist, X_KMEMSTAT, ksp, sizeof(ksp)); - ksp != NULL; ksp = ks.ks_next) { - deref_kptr(ksp, ks, sizeof(ks), malloc type); - if (ks.ks_calls == 0) - continue; - deref_kptr(ks.ks_shortdesc, memname, - sizeof(memname), malloc type name); - (void)printf(%15s %5ld %6ldK %6ldK %6ldK %10ld %5u %5u, - memname, - ks.ks_inuse, howmany(ks.ks_memuse, KILO), - howmany(ks.ks_maxused, KILO), -
CVS commit: src/usr.bin/vmstat
Module Name:src Committed By: para Date: Sun Apr 29 16:23:56 UTC 2012 Modified Files: src/usr.bin/vmstat: vmstat.c Log Message: remove malloc(9) output function from vmstat it is not required and working any more To generate a diff of this commit: cvs rdiff -u -r1.187 -r1.188 src/usr.bin/vmstat/vmstat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sun Apr 1 17:02:47 UTC 2012 Modified Files: src/sys/kern: subr_kmem.c Log Message: don't overallocated once we leave the caches To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/kern/subr_kmem.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/kern/subr_kmem.c diff -u src/sys/kern/subr_kmem.c:1.42 src/sys/kern/subr_kmem.c:1.43 --- src/sys/kern/subr_kmem.c:1.42 Sun Feb 5 03:40:08 2012 +++ src/sys/kern/subr_kmem.c Sun Apr 1 17:02:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kmem.c,v 1.42 2012/02/05 03:40:08 rmind Exp $ */ +/* $NetBSD: subr_kmem.c,v 1.43 2012/04/01 17:02:46 para Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.42 2012/02/05 03:40:08 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.43 2012/04/01 17:02:46 para Exp $); #include sys/param.h #include sys/callback.h @@ -180,7 +180,7 @@ kmem_intr_alloc(size_t size, km_flag_t k if (index = kmem_cache_maxidx) { int ret = uvm_km_kmem_alloc(kmem_va_arena, - (vsize_t)round_page(allocsz), + (vsize_t)round_page(size), ((kmflags KM_SLEEP) ? VM_SLEEP : VM_NOSLEEP) | VM_INSTANTFIT, (vmem_addr_t *)p); return ret ? NULL : p; @@ -229,7 +229,7 @@ kmem_intr_free(void *p, size_t size) if (index = kmem_cache_maxidx) { uvm_km_kmem_free(kmem_va_arena, (vaddr_t)p, - round_page(allocsz)); + round_page(size)); return; }
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sun Apr 1 17:02:47 UTC 2012 Modified Files: src/sys/kern: subr_kmem.c Log Message: don't overallocated once we leave the caches To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/kern/subr_kmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: para Date: Sun Mar 11 19:39:36 UTC 2012 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: call kmem_free with the right address in hdafg_detach for sc_widgets the former code let to memory corruption To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/hdaudio/hdafg.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/dev/pci/hdaudio/hdafg.c diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.15 src/sys/dev/pci/hdaudio/hdafg.c:1.16 --- src/sys/dev/pci/hdaudio/hdafg.c:1.15 Wed Dec 21 02:16:57 2011 +++ src/sys/dev/pci/hdaudio/hdafg.c Sun Mar 11 19:39:36 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $ */ +/* $NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $ */ /* * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk @@ -60,7 +60,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $); +__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $); #include sys/types.h #include sys/param.h @@ -3733,7 +3733,7 @@ static int hdafg_detach(device_t self, int flags) { struct hdafg_softc *sc = device_private(self); - struct hdaudio_widget *w = sc-sc_widgets; + struct hdaudio_widget *wl, *w = sc-sc_widgets; struct hdaudio_assoc *as = sc-sc_assocs; struct hdaudio_control *ctl = sc-sc_ctls; struct hdaudio_mixer *mx = sc-sc_mixers; @@ -3755,10 +3755,10 @@ hdafg_detach(device_t self, int flags) /* restore bios pin widget configuration */ for (nid = sc-sc_startnode; nid sc-sc_endnode; nid++) { - w = hdafg_widget_lookup(sc, nid); - if (w == NULL || w-w_type != COP_AWCAP_TYPE_PIN_COMPLEX) + wl = hdafg_widget_lookup(sc, nid); + if (wl == NULL || wl-w_type != COP_AWCAP_TYPE_PIN_COMPLEX) continue; - hdafg_widget_setconfig(w, w-w_pin.biosconfig); + hdafg_widget_setconfig(wl, wl-w_pin.biosconfig); } if (w)
CVS commit: src/sys/dev/pci/hdaudio
Module Name:src Committed By: para Date: Sun Mar 11 19:39:36 UTC 2012 Modified Files: src/sys/dev/pci/hdaudio: hdafg.c Log Message: call kmem_free with the right address in hdafg_detach for sc_widgets the former code let to memory corruption To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/hdaudio/hdafg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: para Date: Mon Mar 5 13:43:56 UTC 2012 Modified Files: src/sys/rump/librump/rumpkern: vm.c Log Message: adjust rump for static pool_cache count should have went in with subr_vmem 1.73 To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/sys/rump/librump/rumpkern/vm.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/rump/librump/rumpkern/vm.c diff -u src/sys/rump/librump/rumpkern/vm.c:1.123 src/sys/rump/librump/rumpkern/vm.c:1.124 --- src/sys/rump/librump/rumpkern/vm.c:1.123 Sun Feb 19 09:19:41 2012 +++ src/sys/rump/librump/rumpkern/vm.c Mon Mar 5 13:43:56 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vm.c,v 1.123 2012/02/19 09:19:41 martin Exp $ */ +/* $NetBSD: vm.c,v 1.124 2012/03/05 13:43:56 para Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -41,7 +41,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.123 2012/02/19 09:19:41 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.124 2012/03/05 13:43:56 para Exp $); #include sys/param.h #include sys/atomic.h @@ -340,7 +340,7 @@ uvm_init(void) kmem_va_arena = vmem_create(kva, 0, 0, PAGE_SIZE, vmem_alloc, vmem_free, kmem_arena, - 32 * PAGE_SIZE, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM); + 8 * PAGE_SIZE, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM); pool_cache_bootstrap(pagecache, sizeof(struct vm_page), 0, 0, 0, page$, NULL, IPL_NONE, pgctor, pgdtor, NULL);
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: para Date: Mon Mar 5 13:43:56 UTC 2012 Modified Files: src/sys/rump/librump/rumpkern: vm.c Log Message: adjust rump for static pool_cache count should have went in with subr_vmem 1.73 To generate a diff of this commit: cvs rdiff -u -r1.123 -r1.124 src/sys/rump/librump/rumpkern/vm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sun Mar 4 14:28:49 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: make accounting for vm_inuse sane while here don't statically allocated for more caches then required To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/kern/subr_vmem.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.72 src/sys/kern/subr_vmem.c:1.73 --- src/sys/kern/subr_vmem.c:1.72 Fri Feb 10 17:35:47 2012 +++ src/sys/kern/subr_vmem.c Sun Mar 4 14:28:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.72 2012/02/10 17:35:47 para Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.73 2012/03/04 14:28:49 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.72 2012/02/10 17:35:47 para Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.73 2012/03/04 14:28:49 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -248,7 +248,8 @@ static LIST_HEAD(, vmem) vmem_list = LIS #define BT_MAXFREE 64 #define STATIC_VMEM_COUNT 5 #define STATIC_BT_COUNT 200 -#define STATIC_QC_POOL_COUNT (VMEM_QCACHE_IDX_MAX + 1) +/* must be equal or greater then qcache multiplier for kmem_va_arena */ +#define STATIC_QC_POOL_COUNT 8 static struct vmem static_vmems[STATIC_VMEM_COUNT]; static int static_vmem_count = STATIC_VMEM_COUNT; @@ -474,6 +475,7 @@ bt_rembusy(vmem_t *vm, bt_t *bt) { KASSERT(vm-vm_nbusytag 0); + vm-vm_inuse -= bt-bt_size; vm-vm_nbusytag--; LIST_REMOVE(bt, bt_hashlist); } @@ -488,6 +490,7 @@ bt_insbusy(vmem_t *vm, bt_t *bt) list = bt_hashhead(vm, bt-bt_start); LIST_INSERT_HEAD(list, bt, bt_hashlist); vm-vm_nbusytag++; + vm-vm_inuse += bt-bt_size; } /* boundary tag list */ @@ -1265,7 +1268,6 @@ gotit: KASSERT(bt-bt_size = size); bt_remfree(vm, bt); vmem_check(vm); - vm-vm_inuse += size; if (bt-bt_start != start) { btnew2-bt_type = BT_TYPE_FREE; btnew2-bt_start = bt-bt_start; @@ -1357,8 +1359,6 @@ vmem_xfree(vmem_t *vm, vmem_addr_t addr, bt_rembusy(vm, bt); bt-bt_type = BT_TYPE_FREE; - vm-vm_inuse -= bt-bt_size; - /* coalesce */ t = CIRCLEQ_NEXT(bt, bt_seglist); if (t != NULL t-bt_type == BT_TYPE_FREE) {
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sun Mar 4 14:28:49 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: make accounting for vm_inuse sane while here don't statically allocated for more caches then required To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Thu Feb 23 12:24:05 UTC 2012 Modified Files: src/sys/kern: kern_runq.c Log Message: change sched_upreempt_pri default to 0 as discussed on tech-kern@ should improve interactive performance on SMP machines as user preemption happens immediately in x-cpu wakeup case now To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/kern/kern_runq.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/kern/kern_runq.c diff -u src/sys/kern/kern_runq.c:1.33 src/sys/kern/kern_runq.c:1.34 --- src/sys/kern/kern_runq.c:1.33 Fri Dec 2 12:31:03 2011 +++ src/sys/kern/kern_runq.c Thu Feb 23 12:24:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_runq.c,v 1.33 2011/12/02 12:31:03 yamt Exp $ */ +/* $NetBSD: kern_runq.c,v 1.34 2012/02/23 12:24:05 para Exp $ */ /* * Copyright (c) 2007, 2008 Mindaugas Rasiukevicius rmind at NetBSD org @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: kern_runq.c,v 1.33 2011/12/02 12:31:03 yamt Exp $); +__KERNEL_RCSID(0, $NetBSD: kern_runq.c,v 1.34 2012/02/23 12:24:05 para Exp $); #include sys/param.h #include sys/kernel.h @@ -99,7 +99,7 @@ static void sched_balance(void *); /* * Preemption control. */ -int sched_upreempt_pri = PRI_KERNEL; +int sched_upreempt_pri = 0; #ifdef __HAVE_PREEMPTION # ifdef DEBUG int sched_kpreempt_pri = 0;
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Thu Feb 23 12:24:05 UTC 2012 Modified Files: src/sys/kern: kern_runq.c Log Message: change sched_upreempt_pri default to 0 as discussed on tech-kern@ should improve interactive performance on SMP machines as user preemption happens immediately in x-cpu wakeup case now To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/kern/kern_runq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: para Date: Tue Feb 21 17:39:17 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: machdep.c syscall.c Log Message: follow the sa removal for alpha To generate a diff of this commit: cvs rdiff -u -r1.337 -r1.338 src/sys/arch/alpha/alpha/machdep.c cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/alpha/syscall.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/arch/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.337 src/sys/arch/alpha/alpha/machdep.c:1.338 --- src/sys/arch/alpha/alpha/machdep.c:1.337 Mon Feb 6 02:14:11 2012 +++ src/sys/arch/alpha/alpha/machdep.c Tue Feb 21 17:39:17 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.337 2012/02/06 02:14:11 matt Exp $ */ +/* $NetBSD: machdep.c,v 1.338 2012/02/21 17:39:17 para Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.337 2012/02/06 02:14:11 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.338 2012/02/21 17:39:17 para Exp $); #include sys/param.h #include sys/systm.h @@ -77,8 +77,6 @@ __KERNEL_RCSID(0, $NetBSD: machdep.c,v #include sys/cpu.h #include sys/proc.h #include sys/ras.h -#include sys/sa.h -#include sys/savar.h #include sys/sched.h #include sys/reboot.h #include sys/device.h @@ -1528,25 +1526,6 @@ sendsig_siginfo(const ksiginfo_t *ksi, c #endif } - -void -cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted, void *sas, void *ap, void *sp, sa_upcall_t upcall) -{ - struct trapframe *tf; - - tf = l-l_md.md_tf; - - tf-tf_regs[FRAME_PC] = (uint64_t)upcall; - tf-tf_regs[FRAME_RA] = 0; - tf-tf_regs[FRAME_A0] = type; - tf-tf_regs[FRAME_A1] = (uint64_t)sas; - tf-tf_regs[FRAME_A2] = nevents; - tf-tf_regs[FRAME_A3] = ninterrupted; - tf-tf_regs[FRAME_A4] = (uint64_t)ap; - tf-tf_regs[FRAME_T12] = (uint64_t)upcall; /* t12 is pv */ - alpha_pal_wrusp((unsigned long)sp); -} - /* * machine dependent system variables. */ Index: src/sys/arch/alpha/alpha/syscall.c diff -u src/sys/arch/alpha/alpha/syscall.c:1.39 src/sys/arch/alpha/alpha/syscall.c:1.40 --- src/sys/arch/alpha/alpha/syscall.c:1.39 Sat Feb 11 23:16:15 2012 +++ src/sys/arch/alpha/alpha/syscall.c Tue Feb 21 17:39:17 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.39 2012/02/11 23:16:15 martin Exp $ */ +/* $NetBSD: syscall.c,v 1.40 2012/02/21 17:39:17 para Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,15 +89,11 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.39 2012/02/11 23:16:15 martin Exp $); - -#include opt_sa.h +__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.40 2012/02/21 17:39:17 para Exp $); #include sys/param.h #include sys/systm.h #include sys/proc.h -#include sys/sa.h -#include sys/savar.h #include sys/signal.h #include sys/syscall.h #include sys/syscallvar.h @@ -151,12 +147,6 @@ syscall_plain(struct lwp *l, uint64_t co callp = p-p_emul-e_sysent; -#ifdef KERN_SA - if (__predict_false((l-l_savp) - (l-l_savp-savp_pflags SAVP_FLAG_DELIVERING))) - l-l_savp-savp_pflags = ~SAVP_FLAG_DELIVERING; -#endif - switch (code) { case SYS_syscall: case SYS___syscall: @@ -245,12 +235,6 @@ syscall_fancy(struct lwp *l, uint64_t co callp = p-p_emul-e_sysent; -#ifdef KERN_SA - if (__predict_false((l-l_savp) - (l-l_savp-savp_pflags SAVP_FLAG_DELIVERING))) - l-l_savp-savp_pflags = ~SAVP_FLAG_DELIVERING; -#endif - switch (code) { case SYS_syscall: case SYS___syscall:
CVS commit: src/sys
Module Name:src Committed By: para Date: Fri Feb 10 17:35:50 UTC 2012 Modified Files: src/sys/arch/alpha/include: param.h src/sys/arch/amiga/include: param.h src/sys/arch/atari/include: param.h src/sys/arch/cesfic/include: param.h src/sys/arch/hp300/include: param.h src/sys/arch/hppa/include: param.h src/sys/arch/i386/include: param.h src/sys/arch/ia64/include: param.h src/sys/arch/luna68k/include: param.h src/sys/arch/mac68k/include: param.h src/sys/arch/macppc/include: param.h src/sys/arch/mvme68k/include: param.h src/sys/arch/news68k/include: param.h src/sys/arch/next68k/include: param.h src/sys/arch/sh3/include: param.h src/sys/arch/sparc/include: param.h src/sys/arch/sun2/include: param.h src/sys/arch/sun3/include: param.h src/sys/arch/x68k/include: param.h src/sys/kern: subr_vmem.c uipc_mbuf.c src/sys/uvm: uvm_km.c Log Message: proper sizing of kmem_arena on different ports PR port-i386/45946: Kernel locks up in VMEM system To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/include/param.h cvs rdiff -u -r1.48 -r1.49 src/sys/arch/amiga/include/param.h cvs rdiff -u -r1.34 -r1.35 src/sys/arch/atari/include/param.h cvs rdiff -u -r1.11 -r1.12 src/sys/arch/cesfic/include/param.h cvs rdiff -u -r1.52 -r1.53 src/sys/arch/hp300/include/param.h cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hppa/include/param.h cvs rdiff -u -r1.75 -r1.76 src/sys/arch/i386/include/param.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/include/param.h cvs rdiff -u -r1.12 -r1.13 src/sys/arch/luna68k/include/param.h cvs rdiff -u -r1.44 -r1.45 src/sys/arch/mac68k/include/param.h cvs rdiff -u -r1.18 -r1.19 src/sys/arch/macppc/include/param.h cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mvme68k/include/param.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/news68k/include/param.h cvs rdiff -u -r1.11 -r1.12 src/sys/arch/next68k/include/param.h cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sh3/include/param.h cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sparc/include/param.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sun2/include/param.h cvs rdiff -u -r1.59 -r1.60 src/sys/arch/sun3/include/param.h cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x68k/include/param.h cvs rdiff -u -r1.71 -r1.72 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.144 -r1.145 src/sys/kern/uipc_mbuf.c cvs rdiff -u -r1.119 -r1.120 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/arch/alpha/include/param.h diff -u src/sys/arch/alpha/include/param.h:1.40 src/sys/arch/alpha/include/param.h:1.41 --- src/sys/arch/alpha/include/param.h:1.40 Tue Jan 24 20:03:36 2012 +++ src/sys/arch/alpha/include/param.h Fri Feb 10 17:35:50 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.40 2012/01/24 20:03:36 christos Exp $ */ +/* $NetBSD: param.h,v 1.41 2012/02/10 17:35:50 para Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -92,9 +92,10 @@ /* * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. + * No enforced maximum on alpha */ -#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((16 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MAX_UNLIMITED 1 /* * Mach derived conversion macros Index: src/sys/arch/amiga/include/param.h diff -u src/sys/arch/amiga/include/param.h:1.48 src/sys/arch/amiga/include/param.h:1.49 --- src/sys/arch/amiga/include/param.h:1.48 Tue Feb 8 20:20:08 2011 +++ src/sys/arch/amiga/include/param.h Fri Feb 10 17:35:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.48 2011/02/08 20:20:08 rmind Exp $ */ +/* $NetBSD: param.h,v 1.49 2012/02/10 17:35:49 para Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -60,7 +60,7 @@ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((3 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) PAGE_SHIFT) #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) PAGE_SHIFT) #ifdef _KERNEL Index: src/sys/arch/atari/include/param.h diff -u src/sys/arch/atari/include/param.h:1.34 src/sys/arch/atari/include/param.h:1.35 --- src/sys/arch/atari/include/param.h:1.34 Tue Feb 8 20:20:10 2011 +++ src/sys/arch/atari/include/param.h Fri Feb 10 17:35:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.34 2011/02/08 20:20:10 rmind Exp $ */ +/* $NetBSD: param.h,v 1.35 2012/02/10 17:35:49 para Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -60,8 +60,8 @@ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((3 * 1024 * 1024) PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((3 * 1024 * 1024)
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Feb 4 17:56:17 UTC 2012 Modified Files: src/sys/arch/amd64/include: param.h src/sys/arch/arm/include/arm32: param.h src/sys/arch/hppa/include: param.h src/sys/arch/i386/include: param.h src/sys/arch/sparc64/include: param.h src/sys/uvm: uvm_km.c Log Message: improve sizing of kmem_arena now that more allocations are made from it don't enforce limits if not required ok: riz@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/param.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/include/arm32/param.h cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hppa/include/param.h cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/include/param.h cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sparc64/include/param.h cvs rdiff -u -r1.118 -r1.119 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/arch/amd64/include/param.h diff -u src/sys/arch/amd64/include/param.h:1.16 src/sys/arch/amd64/include/param.h:1.17 --- src/sys/arch/amd64/include/param.h:1.16 Tue Jan 24 20:03:36 2012 +++ src/sys/arch/amd64/include/param.h Sat Feb 4 17:56:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.16 2012/01/24 20:03:36 christos Exp $ */ +/* $NetBSD: param.h,v 1.17 2012/02/04 17:56:16 para Exp $ */ #ifdef __x86_64__ @@ -81,11 +81,12 @@ #endif /* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized + * Minimum size of the kernel kmem_arena in PAGE_SIZE-sized * logical pages. + * No enforced maximum on amd64. */ #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((1 *1024 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MAX_UNLIMITED 1 /* * XXXfvdl the PD* stuff is different from i386. Index: src/sys/arch/arm/include/arm32/param.h diff -u src/sys/arch/arm/include/arm32/param.h:1.16 src/sys/arch/arm/include/arm32/param.h:1.17 --- src/sys/arch/arm/include/arm32/param.h:1.16 Fri Jan 14 02:06:24 2011 +++ src/sys/arch/arm/include/arm32/param.h Sat Feb 4 17:56:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.16 2011/01/14 02:06:24 rmind Exp $ */ +/* $NetBSD: param.h,v 1.17 2012/02/04 17:56:16 para Exp $ */ /* * Copyright (c) 1994,1995 Mark Brinicombe. @@ -64,8 +64,8 @@ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((7 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) PAGE_SHIFT) /* Constants used to divide the USPACE area */ Index: src/sys/arch/hppa/include/param.h diff -u src/sys/arch/hppa/include/param.h:1.17 src/sys/arch/hppa/include/param.h:1.18 --- src/sys/arch/hppa/include/param.h:1.17 Tue Jan 24 20:03:36 2012 +++ src/sys/arch/hppa/include/param.h Sat Feb 4 17:56:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.17 2012/01/24 20:03:36 christos Exp $ */ +/* $NetBSD: param.h,v 1.18 2012/02/04 17:56:16 para Exp $ */ /* $OpenBSD: param.h,v 1.12 2001/07/06 02:07:41 provos Exp $ */ @@ -83,7 +83,7 @@ * Size of kernel malloc arena in logical pages */ #define NKMEMPAGES_MIN_DEFAULT ((16 * 1024 * 1024) PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((16 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) PAGE_SHIFT) /* * Mach derived conversion macros Index: src/sys/arch/i386/include/param.h diff -u src/sys/arch/i386/include/param.h:1.74 src/sys/arch/i386/include/param.h:1.75 --- src/sys/arch/i386/include/param.h:1.74 Tue Jan 24 20:03:37 2012 +++ src/sys/arch/i386/include/param.h Sat Feb 4 17:56:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.74 2012/01/24 20:03:37 christos Exp $ */ +/* $NetBSD: param.h,v 1.75 2012/02/04 17:56:16 para Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -129,7 +129,7 @@ * logical pages. */ #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((280 * 1024 * 1024) PAGE_SHIFT) /* * Mach derived conversion macros Index: src/sys/arch/sparc64/include/param.h diff -u src/sys/arch/sparc64/include/param.h:1.47 src/sys/arch/sparc64/include/param.h:1.48 --- src/sys/arch/sparc64/include/param.h:1.47 Tue Jan 24 20:03:38 2012 +++ src/sys/arch/sparc64/include/param.h Sat Feb 4 17:56:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.47 2012/01/24 20:03:38 christos Exp $ */ +/* $NetBSD: param.h,v 1.48 2012/02/04 17:56:16 para Exp $ */ /* * Copyright (c) 1992, 1993 @@ -193,11 +193,12 @@ extern int nbpg, pgofset, pgshift; #define MSGBUFSIZE NBPG /* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized + * Minimum size of the
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Feb 4 22:11:43 UTC 2012 Modified Files: src/sys/kern: subr_pool.c src/sys/rump/librump/rumpkern: memalloc.c Log Message: make acorn26 compile by fixing up subpage pool allocations ok: riz@ To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/kern/subr_pool.c cvs rdiff -u -r1.11 -r1.12 src/sys/rump/librump/rumpkern/memalloc.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/kern/subr_pool.c diff -u src/sys/kern/subr_pool.c:1.193 src/sys/kern/subr_pool.c:1.194 --- src/sys/kern/subr_pool.c:1.193 Sun Jan 29 20:20:18 2012 +++ src/sys/kern/subr_pool.c Sat Feb 4 22:11:42 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.193 2012/01/29 20:20:18 he Exp $ */ +/* $NetBSD: subr_pool.c,v 1.194 2012/02/04 22:11:42 para Exp $ */ /*- * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010 @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_pool.c,v 1.193 2012/01/29 20:20:18 he Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_pool.c,v 1.194 2012/02/04 22:11:42 para Exp $); #include opt_ddb.h #include opt_pool.h @@ -2730,13 +2730,10 @@ struct pool_allocator pool_allocator_kme }; #endif -void *pool_page_alloc_nointr(struct pool *, int); -void pool_page_free_nointr(struct pool *, void *); - #ifdef POOL_SUBPAGE struct pool_allocator pool_allocator_nointr_fullpage = { - .pa_alloc = pool_page_alloc_nointr, - .pa_free = pool_page_free_nointr, + .pa_alloc = pool_page_alloc, + .pa_free = pool_page_free, .pa_pagesz = 0 }; #else @@ -2757,9 +2754,6 @@ struct pool_allocator pool_allocator_kme .pa_pagesz = POOL_SUBPAGE }; -void *pool_subpage_alloc_nointr(struct pool *, int); -void pool_subpage_free_nointr(struct pool *, void *); - struct pool_allocator pool_allocator_nointr = { .pa_alloc = pool_subpage_alloc, .pa_free = pool_subpage_free, @@ -2850,20 +2844,6 @@ pool_subpage_free(struct pool *pp, void pool_put(psppool, v); } -/* We don't provide a real nointr allocator. Maybe later. */ -void * -pool_subpage_alloc_nointr(struct pool *pp, int flags) -{ - - return (pool_subpage_alloc(pp, flags)); -} - -void -pool_subpage_free_nointr(struct pool *pp, void *v) -{ - - pool_subpage_free(pp, v); -} #endif /* POOL_SUBPAGE */ #if defined(DDB) Index: src/sys/rump/librump/rumpkern/memalloc.c diff -u src/sys/rump/librump/rumpkern/memalloc.c:1.11 src/sys/rump/librump/rumpkern/memalloc.c:1.12 --- src/sys/rump/librump/rumpkern/memalloc.c:1.11 Sun Jul 11 11:27:47 2010 +++ src/sys/rump/librump/rumpkern/memalloc.c Sat Feb 4 22:11:43 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: memalloc.c,v 1.11 2010/07/11 11:27:47 pooka Exp $ */ +/* $NetBSD: memalloc.c,v 1.12 2012/02/04 22:11:43 para Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: memalloc.c,v 1.11 2010/07/11 11:27:47 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: memalloc.c,v 1.12 2012/02/04 22:11:43 para Exp $); #include sys/param.h #include sys/kmem.h @@ -322,17 +322,17 @@ pool_prime(struct pool *pp, int nitems) } /* XXX: for tmpfs, shouldn't be here */ -void *pool_page_alloc_nointr(struct pool *, int); -void pool_page_free_nointr(struct pool *, void *); +void *pool_page_alloc(struct pool *, int); +void pool_page_free(struct pool *, void *); void * -pool_page_alloc_nointr(struct pool *pp, int flags) +pool_page_alloc(struct pool *pp, int flags) { return pool_get(pp, flags); } void -pool_page_free_nointr(struct pool *pp, void *item) +pool_page_free(struct pool *pp, void *item) { return pool_put(pp, item);
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Feb 4 17:56:17 UTC 2012 Modified Files: src/sys/arch/amd64/include: param.h src/sys/arch/arm/include/arm32: param.h src/sys/arch/hppa/include: param.h src/sys/arch/i386/include: param.h src/sys/arch/sparc64/include: param.h src/sys/uvm: uvm_km.c Log Message: improve sizing of kmem_arena now that more allocations are made from it don't enforce limits if not required ok: riz@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/include/param.h cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/include/arm32/param.h cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hppa/include/param.h cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/include/param.h cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sparc64/include/param.h cvs rdiff -u -r1.118 -r1.119 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.
CVS commit: src/sys
Module Name:src Committed By: para Date: Sat Feb 4 22:11:43 UTC 2012 Modified Files: src/sys/kern: subr_pool.c src/sys/rump/librump/rumpkern: memalloc.c Log Message: make acorn26 compile by fixing up subpage pool allocations ok: riz@ To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/kern/subr_pool.c cvs rdiff -u -r1.11 -r1.12 src/sys/rump/librump/rumpkern/memalloc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: para Date: Thu Feb 2 18:59:45 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: pmap.c src/sys/arch/mips/mips: pmap.c src/sys/arch/powerpc/booke: booke_pmap.c src/sys/arch/vax/vax: pmap.c src/sys/uvm: uvm_extern.h uvm_km.c Log Message: - bringing kmeminit_nkmempages back and revert pmaps that called this early - use nkmempages to scale the kmem_arena - reducing diff to pre kmem/vmem change (NKMEMPAGES_MAX_DEFAULT will need adjusting on some archs) To generate a diff of this commit: cvs rdiff -u -r1.256 -r1.257 src/sys/arch/alpha/alpha/pmap.c cvs rdiff -u -r1.206 -r1.207 src/sys/arch/mips/mips/pmap.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/booke/booke_pmap.c cvs rdiff -u -r1.181 -r1.182 src/sys/arch/vax/vax/pmap.c cvs rdiff -u -r1.180 -r1.181 src/sys/uvm/uvm_extern.h cvs rdiff -u -r1.116 -r1.117 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/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.256 src/sys/arch/alpha/alpha/pmap.c:1.257 --- src/sys/arch/alpha/alpha/pmap.c:1.256 Fri Jan 27 19:48:38 2012 +++ src/sys/arch/alpha/alpha/pmap.c Thu Feb 2 18:59:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.256 2012/01/27 19:48:38 para Exp $ */ +/* $NetBSD: pmap.c,v 1.257 2012/02/02 18:59:44 para Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.256 2012/01/27 19:48:38 para Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.257 2012/02/02 18:59:44 para Exp $); #include sys/param.h #include sys/systm.h @@ -757,6 +757,11 @@ pmap_bootstrap(paddr_t ptaddr, u_int max #endif /* + * Compute the number of pages kmem_arena will have. + */ + kmeminit_nkmempages(); + + /* * Figure out how many initial PTE's are necessary to map the * kernel. We also reserve space for kmem_alloc_pageable() * for vm_fork(). @@ -769,7 +774,7 @@ pmap_bootstrap(paddr_t ptaddr, u_int max lev3mapsize = (VM_PHYS_SIZE + (ubc_nwins ubc_winshift) + bufsz + 16 * NCARGS + pager_map_size) / PAGE_SIZE + - (maxproc * UPAGES) + (256 * 1024 * 1024) / PAGE_SIZE; + (maxproc * UPAGES) + nkmempages; #ifdef SYSVSHM lev3mapsize += shminfo.shmall; Index: src/sys/arch/mips/mips/pmap.c diff -u src/sys/arch/mips/mips/pmap.c:1.206 src/sys/arch/mips/mips/pmap.c:1.207 --- src/sys/arch/mips/mips/pmap.c:1.206 Fri Jan 27 19:48:39 2012 +++ src/sys/arch/mips/mips/pmap.c Thu Feb 2 18:59:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.206 2012/01/27 19:48:39 para Exp $ */ +/* $NetBSD: pmap.c,v 1.207 2012/02/02 18:59:44 para Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.206 2012/01/27 19:48:39 para Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.207 2012/02/02 18:59:44 para Exp $); /* * Manages physical address maps. @@ -496,6 +496,11 @@ pmap_bootstrap(void) pmap_tlb_info_init(pmap_tlb0_info); /* init the lock */ /* + * Compute the number of pages kmem_arena will have. + */ + kmeminit_nkmempages(); + + /* * Figure out how many PTE's are necessary to map the kernel. * We also reserve space for kmem_alloc_pageable() for vm_fork(). */ @@ -507,7 +512,7 @@ pmap_bootstrap(void) Sysmapsize = (VM_PHYS_SIZE + (ubc_nwins ubc_winshift) + bufsz + 16 * NCARGS + pager_map_size + iospace_size) / NBPG + - (maxproc * UPAGES) + 1024 * 1024; + (maxproc * UPAGES) + nkmempages; #ifdef DEBUG { extern int kmem_guard_depth; Index: src/sys/arch/powerpc/booke/booke_pmap.c diff -u src/sys/arch/powerpc/booke/booke_pmap.c:1.11 src/sys/arch/powerpc/booke/booke_pmap.c:1.12 --- src/sys/arch/powerpc/booke/booke_pmap.c:1.11 Fri Jan 27 19:48:39 2012 +++ src/sys/arch/powerpc/booke/booke_pmap.c Thu Feb 2 18:59:44 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: booke_pmap.c,v 1.11 2012/01/27 19:48:39 para Exp $ */ +/* $NetBSD: booke_pmap.c,v 1.12 2012/02/02 18:59:44 para Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -38,7 +38,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: booke_pmap.c,v 1.11 2012/01/27 19:48:39 para Exp $); +__KERNEL_RCSID(0, $NetBSD: booke_pmap.c,v 1.12 2012/02/02 18:59:44 para Exp $); #include sys/param.h #include sys/kcore.h @@ -146,6 +146,11 @@ pmap_bootstrap(vaddr_t startkernel, vadd pmap_tlb_info_init(pmap_tlb0_info); /* init the lock */ /* + * Compute the number of pages kmem_arena will have. + */ + kmeminit_nkmempages(); + + /* * Figure out how many PTE's are necessary to map the kernel. * We also reserve space for kmem_alloc_pageable() for vm_fork(). */ @@ -164,7 +169,7 @@ pmap_bootstrap(vaddr_t startkernel, vadd #ifdef SYSVSHM
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: para Date: Thu Feb 2 20:11:26 UTC 2012 Modified Files: src/sys/arch/xen/xen: xbd_xenbus.c Log Message: call uvm_km_kmem_alloc with right arguments fixes: kern/45913 To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/arch/xen/xen/xbd_xenbus.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/arch/xen/xen/xbd_xenbus.c diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.52 src/sys/arch/xen/xen/xbd_xenbus.c:1.53 --- src/sys/arch/xen/xen/xbd_xenbus.c:1.52 Thu Feb 2 19:43:01 2012 +++ src/sys/arch/xen/xen/xbd_xenbus.c Thu Feb 2 20:11:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: xbd_xenbus.c,v 1.52 2012/02/02 19:43:01 tls Exp $ */ +/* $NetBSD: xbd_xenbus.c,v 1.53 2012/02/02 20:11:26 para Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -50,7 +50,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xbd_xenbus.c,v 1.52 2012/02/02 19:43:01 tls Exp $); +__KERNEL_RCSID(0, $NetBSD: xbd_xenbus.c,v 1.53 2012/02/02 20:11:26 para Exp $); #include opt_xen.h @@ -1058,7 +1058,7 @@ xbd_map_align(struct xbd_req *req) rc = uvm_km_kmem_alloc(kmem_va_arena, req-req_bp-b_bcount, (VM_NOSLEEP | VM_INSTANTFIT), - req-req_data); + (vmem_addr_t *)req-req_data); splx(s); if (__predict_false(rc != 0)) return ENOMEM;
CVS commit: src/sys
Module Name:src Committed By: para Date: Thu Feb 2 18:59:45 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: pmap.c src/sys/arch/mips/mips: pmap.c src/sys/arch/powerpc/booke: booke_pmap.c src/sys/arch/vax/vax: pmap.c src/sys/uvm: uvm_extern.h uvm_km.c Log Message: - bringing kmeminit_nkmempages back and revert pmaps that called this early - use nkmempages to scale the kmem_arena - reducing diff to pre kmem/vmem change (NKMEMPAGES_MAX_DEFAULT will need adjusting on some archs) To generate a diff of this commit: cvs rdiff -u -r1.256 -r1.257 src/sys/arch/alpha/alpha/pmap.c cvs rdiff -u -r1.206 -r1.207 src/sys/arch/mips/mips/pmap.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/booke/booke_pmap.c cvs rdiff -u -r1.181 -r1.182 src/sys/arch/vax/vax/pmap.c cvs rdiff -u -r1.180 -r1.181 src/sys/uvm/uvm_extern.h cvs rdiff -u -r1.116 -r1.117 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.
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: para Date: Thu Feb 2 20:11:26 UTC 2012 Modified Files: src/sys/arch/xen/xen: xbd_xenbus.c Log Message: call uvm_km_kmem_alloc with right arguments fixes: kern/45913 To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/arch/xen/xen/xbd_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: para Date: Wed Feb 1 23:43:49 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c vfs_bio.c src/sys/uvm: uvm_glue.c uvm_km.c uvm_pdaemon.c Log Message: allocate uareas and buffers from kernel_map again add code to drain pools if kmem_arena runs out of space To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.235 -r1.236 src/sys/kern/vfs_bio.c cvs rdiff -u -r1.153 -r1.154 src/sys/uvm/uvm_glue.c cvs rdiff -u -r1.115 -r1.116 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.104 -r1.105 src/sys/uvm/uvm_pdaemon.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.70 src/sys/kern/subr_vmem.c:1.71 --- src/sys/kern/subr_vmem.c:1.70 Mon Jan 30 17:35:18 2012 +++ src/sys/kern/subr_vmem.c Wed Feb 1 23:43:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.70 2012/01/30 17:35:18 para Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.71 2012/02/01 23:43:49 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.70 2012/01/30 17:35:18 para Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.71 2012/02/01 23:43:49 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -1245,6 +1245,11 @@ retry: /* XXX */ if ((flags VM_SLEEP) != 0) { +#if defined(_KERNEL) !defined(_RUMPKERNEL) + mutex_spin_enter(uvm_fpageqlock); + uvm_kick_pdaemon(); + mutex_spin_exit(uvm_fpageqlock); +#endif VMEM_LOCK(vm); VMEM_CONDVAR_WAIT(vm); VMEM_UNLOCK(vm); Index: src/sys/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.235 src/sys/kern/vfs_bio.c:1.236 --- src/sys/kern/vfs_bio.c:1.235 Sat Jan 28 00:00:06 2012 +++ src/sys/kern/vfs_bio.c Wed Feb 1 23:43:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.235 2012/01/28 00:00:06 rmind Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.236 2012/02/01 23:43:49 para Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vfs_bio.c,v 1.235 2012/01/28 00:00:06 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: vfs_bio.c,v 1.236 2012/02/01 23:43:49 para Exp $); #include opt_bufcache.h @@ -231,21 +231,18 @@ static struct vm_map *buf_map; static void * bufpool_page_alloc(struct pool *pp, int flags) { - const vm_flag_t vflags = (flags PR_WAITOK) ? VM_SLEEP: VM_NOSLEEP; - vmem_addr_t va; - int ret; - ret = uvm_km_kmem_alloc(kmem_va_arena, MAXBSIZE, - vflags | VM_INSTANTFIT, va); - - return ret ? NULL : (void *)va; + return (void *)uvm_km_alloc(buf_map, + MAXBSIZE, MAXBSIZE, + ((flags PR_WAITOK) ? 0 : UVM_KMF_NOWAIT|UVM_KMF_TRYLOCK) + | UVM_KMF_WIRED); } static void bufpool_page_free(struct pool *pp, void *v) { - uvm_km_kmem_free(kmem_va_arena, (vaddr_t)v, MAXBSIZE); + uvm_km_free(buf_map, (vaddr_t)v, MAXBSIZE, UVM_KMF_WIRED); } static struct pool_allocator bufmempool_allocator = { @@ -491,7 +488,7 @@ bufinit(void) pa = (size = PAGE_SIZE use_std) ? pool_allocator_nointr : bufmempool_allocator; - pool_init(pp, size, 0, 0, PR_NOALIGN, name, pa, IPL_NONE); + pool_init(pp, size, 0, 0, 0, name, pa, IPL_NONE); pool_setlowat(pp, 1); pool_sethiwat(pp, 1); } Index: src/sys/uvm/uvm_glue.c diff -u src/sys/uvm/uvm_glue.c:1.153 src/sys/uvm/uvm_glue.c:1.154 --- src/sys/uvm/uvm_glue.c:1.153 Fri Jan 27 19:48:41 2012 +++ src/sys/uvm/uvm_glue.c Wed Feb 1 23:43:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_glue.c,v 1.153 2012/01/27 19:48:41 para Exp $ */ +/* $NetBSD: uvm_glue.c,v 1.154 2012/02/01 23:43:49 para 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.153 2012/01/27 19:48:41 para Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_glue.c,v 1.154 2012/02/01 23:43:49 para Exp $); #include opt_kgdb.h #include opt_kstack.h @@ -240,15 +240,26 @@ static pool_cache_t uvm_uarea_system_cac static void * uarea_poolpage_alloc(struct pool *pp, int flags) { - if (USPACE_ALIGN == 0) { - int rc; - vmem_addr_t va; - - rc = uvm_km_kmem_alloc(kmem_va_arena, USPACE, - ((flags PR_WAITOK) ? VM_SLEEP: VM_NOSLEEP) | - VM_INSTANTFIT, va); - return (rc != 0) ? NULL : (void *)va; +#if defined(PMAP_MAP_POOLPAGE) + 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)); +#else + pg = uvm_pagealloc(NULL, 0, NULL, + ((flags PR_WAITOK) == 0 ? UVM_KMF_NOWAIT : 0)); +#endif + if (pg == NULL) + return NULL; + va = PMAP_MAP_POOLPAGE(VM_PAGE_TO_PHYS(pg)); + if (va == 0) + uvm_pagefree(pg); + return (void *)va; } +#endif #if defined(__HAVE_CPU_UAREA_ROUTINES)
CVS commit: src/sys
Module Name:src Committed By: para Date: Wed Feb 1 23:43:49 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c vfs_bio.c src/sys/uvm: uvm_glue.c uvm_km.c uvm_pdaemon.c Log Message: allocate uareas and buffers from kernel_map again add code to drain pools if kmem_arena runs out of space To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.235 -r1.236 src/sys/kern/vfs_bio.c cvs rdiff -u -r1.153 -r1.154 src/sys/uvm/uvm_glue.c cvs rdiff -u -r1.115 -r1.116 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.104 -r1.105 src/sys/uvm/uvm_pdaemon.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sun2/sun2
Module Name:src Committed By: para Date: Tue Jan 31 22:47:08 UTC 2012 Modified Files: src/sys/arch/sun2/sun2: pmap.c Log Message: unbreak the sun2 pmap To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sun2/sun2/pmap.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/arch/sun2/sun2/pmap.c diff -u src/sys/arch/sun2/sun2/pmap.c:1.44 src/sys/arch/sun2/sun2/pmap.c:1.45 --- src/sys/arch/sun2/sun2/pmap.c:1.44 Fri Jun 3 17:03:52 2011 +++ src/sys/arch/sun2/sun2/pmap.c Tue Jan 31 22:47:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.44 2011/06/03 17:03:52 tsutsui Exp $ */ +/* $NetBSD: pmap.c,v 1.45 2012/01/31 22:47:08 para Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -82,7 +82,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.44 2011/06/03 17:03:52 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.45 2012/01/31 22:47:08 para Exp $); #include opt_ddb.h #include opt_pmap_debug.h @@ -90,7 +90,7 @@ __KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.4 #include sys/param.h #include sys/systm.h #include sys/proc.h -#include sys/malloc.h +#include sys/kmem.h #include sys/pool.h #include sys/queue.h #include sys/kcore.h @@ -1820,7 +1820,7 @@ void pmap_user_init(pmap_t pmap) { int i; - pmap-pm_segmap = malloc(sizeof(char)*NUSEG, M_VMPMAP, M_WAITOK); + pmap-pm_segmap = kmem_alloc(sizeof(char)*NUSEG, KM_SLEEP); for (i = 0; i NUSEG; i++) { pmap-pm_segmap[i] = SEGINV; } @@ -1871,7 +1871,7 @@ pmap_release(struct pmap *pmap) #endif context_free(pmap); } - free(pmap-pm_segmap, M_VMPMAP); + kmem_free(pmap-pm_segmap, sizeof(char)*NUSEG); pmap-pm_segmap = NULL; splx(s);
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Mon Jan 30 17:22:01 UTC 2012 Modified Files: src/sys/uvm: uvm_pdpolicy_clock.c Log Message: removed code from uvmpdpol_needsscan_p that got there by mistake pointed out by yamt@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/uvm/uvm_pdpolicy_clock.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_pdpolicy_clock.c diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.16 src/sys/uvm/uvm_pdpolicy_clock.c:1.17 --- src/sys/uvm/uvm_pdpolicy_clock.c:1.16 Sat Jan 28 00:00:06 2012 +++ src/sys/uvm/uvm_pdpolicy_clock.c Mon Jan 30 17:21:52 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pdpolicy_clock.c,v 1.16 2012/01/28 00:00:06 rmind Exp $ */ +/* $NetBSD: uvm_pdpolicy_clock.c,v 1.17 2012/01/30 17:21:52 para Exp $ */ /* NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $ */ /* @@ -69,7 +69,7 @@ #else /* defined(PDSIM) */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.16 2012/01/28 00:00:06 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_pdpolicy_clock.c,v 1.17 2012/01/30 17:21:52 para Exp $); #include sys/param.h #include sys/proc.h @@ -419,22 +419,8 @@ uvmpdpol_reinit(void) bool uvmpdpol_needsscan_p(void) { - vmem_size_t kva_size, kva_free; - kva_size = vmem_size(kmem_arena, VMEM_FREE | VMEM_ALLOC); - kva_free = vmem_size(kmem_arena, VMEM_FREE); - - if (kva_free (kva_size / 10)) { - return true; - } - - if (pdpol_state.s_inactive pdpol_state.s_inactarg) { - return true; - } - if (pdpol_state.s_inactive pdpol_state.s_inactarg) { - return true; - } - return false; + return pdpol_state.s_inactive pdpol_state.s_inactarg; } void
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Mon Jan 30 17:35:18 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: do the bookkeeping right To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/kern/subr_vmem.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.69 src/sys/kern/subr_vmem.c:1.70 --- src/sys/kern/subr_vmem.c:1.69 Sun Jan 29 17:27:37 2012 +++ src/sys/kern/subr_vmem.c Mon Jan 30 17:35:18 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.69 2012/01/29 17:27:37 rmind Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.70 2012/01/30 17:35:18 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.69 2012/01/29 17:27:37 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.70 2012/01/30 17:35:18 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -1260,6 +1260,7 @@ gotit: KASSERT(bt-bt_size = size); bt_remfree(vm, bt); vmem_check(vm); + vm-vm_inuse += size; if (bt-bt_start != start) { btnew2-bt_type = BT_TYPE_FREE; btnew2-bt_start = bt-bt_start;
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Mon Jan 30 17:22:01 UTC 2012 Modified Files: src/sys/uvm: uvm_pdpolicy_clock.c Log Message: removed code from uvmpdpol_needsscan_p that got there by mistake pointed out by yamt@ To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/uvm/uvm_pdpolicy_clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Mon Jan 30 17:35:18 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: do the bookkeeping right To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/external/bsd/drm/dist/bsd-core
we should fix the inconsistent use then, the problem ist malloc(9) does not return page aligned memory as kmem does now, for allocations = PAGE_SIZE and that break drm mmap where does the diagnostic panic occur? lars On Sun, Jan 29, 2012 at 12:49 PM, Matthias Drochner droch...@netbsd.org wrote: Module Name: src Committed By: drochner Date: Sun Jan 29 11:49:02 UTC 2012 Modified Files: src/sys/external/bsd/drm/dist/bsd-core: drm_bufs.c Log Message: remove incomplete conversion to kmem_alloc -- inconsistent use leads at least to diagnostic panics To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm/dist/bsd-core/drm_bufs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: para Date: Sun Jan 29 11:49:58 UTC 2012 Modified Files: src/sys/arch/sparc/sparc: pmap.c Log Message: fix sparc after kmem_map is gone To generate a diff of this commit: cvs rdiff -u -r1.347 -r1.348 src/sys/arch/sparc/sparc/pmap.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/arch/sparc/sparc/pmap.c diff -u src/sys/arch/sparc/sparc/pmap.c:1.347 src/sys/arch/sparc/sparc/pmap.c:1.348 --- src/sys/arch/sparc/sparc/pmap.c:1.347 Sat Oct 22 21:00:40 2011 +++ src/sys/arch/sparc/sparc/pmap.c Sun Jan 29 11:49:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.347 2011/10/22 21:00:40 mrg Exp $ */ +/* $NetBSD: pmap.c,v 1.348 2012/01/29 11:49:58 para Exp $ */ /* * Copyright (c) 1996 @@ -56,7 +56,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.347 2011/10/22 21:00:40 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.348 2012/01/29 11:49:58 para Exp $); #include opt_ddb.h #include opt_kgdb.h @@ -880,7 +880,7 @@ pgt_page_alloc(struct pool *pp, int flag return (NULL); /* Allocate virtual memory */ - va = uvm_km_alloc(kmem_map, PAGE_SIZE, 0, UVM_KMF_VAONLY | + va = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_VAONLY | ((flags PR_WAITOK) ? 0 : UVM_KMF_NOWAIT | UVM_KMF_TRYLOCK)); if (va == 0) { uvm_pagefree(pg); @@ -917,7 +917,7 @@ pgt_page_free(struct pool *pp, void *v) KASSERT(rv); uvm_pagefree(PHYS_TO_VM_PAGE(pa)); pmap_kremove(va, PAGE_SIZE); - uvm_km_free(kmem_map, va, PAGE_SIZE, UVM_KMF_VAONLY); + uvm_km_free(kernel_map, va, PAGE_SIZE, UVM_KMF_VAONLY); } #endif /* SUN4M || SUN4D */
CVS commit: src/sys/ufs/ufs
Module Name:src Committed By: para Date: Sun Jan 29 11:59:14 UTC 2012 Modified Files: src/sys/ufs/ufs: ufs_quota.c Log Message: sprinkel some #ifdef QUOTA2 to avoid unused variables To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/ufs/ufs/ufs_quota.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/ufs/ufs/ufs_quota.c diff -u src/sys/ufs/ufs/ufs_quota.c:1.104 src/sys/ufs/ufs/ufs_quota.c:1.105 --- src/sys/ufs/ufs/ufs_quota.c:1.104 Sun Jan 29 07:16:53 2012 +++ src/sys/ufs/ufs/ufs_quota.c Sun Jan 29 11:59:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota.c,v 1.104 2012/01/29 07:16:53 dholland Exp $ */ +/* $NetBSD: ufs_quota.c,v 1.105 2012/01/29 11:59:14 para Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993, 1995 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.104 2012/01/29 07:16:53 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.105 2012/01/29 11:59:14 para Exp $); #if defined(_KERNEL_OPT) #include opt_quota.h @@ -430,7 +430,9 @@ static int quota_handle_cmd_cursoropen(struct mount *mp, struct lwp *l, struct vfs_quotactl_args *args) { +#ifdef QUOTA2 struct ufsmount *ump = VFSTOUFS(mp); +#endif struct quotakcursor *cursor; int error; @@ -456,7 +458,9 @@ static int quota_handle_cmd_cursorclose(struct mount *mp, struct lwp *l, struct vfs_quotactl_args *args) { +#ifdef QUOTA2 struct ufsmount *ump = VFSTOUFS(mp); +#endif struct quotakcursor *cursor; int error; @@ -482,7 +486,9 @@ static int quota_handle_cmd_cursorskipidtype(struct mount *mp, struct lwp *l, struct vfs_quotactl_args *args) { +#ifdef QUOTA2 struct ufsmount *ump = VFSTOUFS(mp); +#endif struct quotakcursor *cursor; int idtype; int error; @@ -505,7 +511,9 @@ static int quota_handle_cmd_cursoratend(struct mount *mp, struct lwp *l, struct vfs_quotactl_args *args) { +#ifdef QUOTA2 struct ufsmount *ump = VFSTOUFS(mp); +#endif struct quotakcursor *cursor; int *ret; int error; @@ -528,7 +536,9 @@ static int quota_handle_cmd_cursorrewind(struct mount *mp, struct lwp *l, struct vfs_quotactl_args *args) { +#ifdef QUOTA2 struct ufsmount *ump = VFSTOUFS(mp); +#endif struct quotakcursor *cursor; int error;
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Sun Jan 29 12:37:01 UTC 2012 Modified Files: src/sys/uvm: uvm_km.c Log Message: size kmem_arena more sanely for small memory machines To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 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_km.c diff -u src/sys/uvm/uvm_km.c:1.112 src/sys/uvm/uvm_km.c:1.113 --- src/sys/uvm/uvm_km.c:1.112 Fri Jan 27 19:48:41 2012 +++ src/sys/uvm/uvm_km.c Sun Jan 29 12:37:01 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.112 2012/01/27 19:48:41 para Exp $ */ +/* $NetBSD: uvm_km.c,v 1.113 2012/01/29 12:37:01 para Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -120,7 +120,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.112 2012/01/27 19:48:41 para Exp $); +__KERNEL_RCSID(0, $NetBSD: uvm_km.c,v 1.113 2012/01/29 12:37:01 para Exp $); #include opt_uvmhist.h @@ -168,7 +168,7 @@ uvm_km_bootstrap(vaddr_t start, vaddr_t vaddr_t base = VM_MIN_KERNEL_ADDRESS; kmemsize = MIN(vsize_t)(end - start)) / 3) * 2), - vsize_t)uvmexp.npages) * PAGE_SIZE) / 3)); + vsize_t)uvmexp.npages) * PAGE_SIZE))); kmemsize = round_page(kmemsize); /*
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sun Jan 29 13:38:15 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: move condvar calls under interlock protection call uvm_kick_pdaemon in case we can sleep and no space in arena To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/kern/subr_vmem.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/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.67 src/sys/kern/subr_vmem.c:1.68 --- src/sys/kern/subr_vmem.c:1.67 Sat Jan 28 23:05:48 2012 +++ src/sys/kern/subr_vmem.c Sun Jan 29 13:38:15 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.67 2012/01/28 23:05:48 rmind Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.68 2012/01/29 13:38:15 para Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.67 2012/01/28 23:05:48 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: subr_vmem.c,v 1.68 2012/01/29 13:38:15 para Exp $); #if defined(_KERNEL) #include opt_ddb.h @@ -1247,6 +1247,13 @@ retry: } /* XXX */ + if ((flags VM_SLEEP) != 0) { + uvm_kick_pdaemon(); + VMEM_LOCK(vm); + VMEM_CONDVAR_WAIT(vm); + VMEM_UNLOCK(vm); + goto retry; + } fail: bt_free(vm, btnew); bt_free(vm, btnew2); @@ -1385,10 +1392,16 @@ vmem_xfree(vmem_t *vm, vmem_addr_t addr, bt_remseg(vm, t); LIST_INSERT_HEAD(tofree, t, bt_freelist); vm-vm_size -= spansize; +#if defined(_KERNEL) + VMEM_CONDVAR_BROADCAST(vm); +#endif /* defined(_KERNEL) */ VMEM_UNLOCK(vm); (*vm-vm_releasefn)(vm-vm_arg, spanaddr, spansize); } else { bt_insfree(vm, bt); +#if defined(_KERNEL) + VMEM_CONDVAR_BROADCAST(vm); +#endif /* defined(_KERNEL) */ VMEM_UNLOCK(vm); } @@ -1397,9 +1410,6 @@ vmem_xfree(vmem_t *vm, vmem_addr_t addr, LIST_REMOVE(t, bt_freelist); bt_free(vm, t); } -#if defined(_KERNEL) - VMEM_CONDVAR_BROADCAST(vm); -#endif /* defined(_KERNEL) */ } /* @@ -1471,7 +1481,6 @@ vmem_rehash_all(struct work *wk, void *d if (desired current * 2 || desired * 2 current) { vmem_rehash(vm, desired, VM_NOSLEEP); } - VMEM_CONDVAR_BROADCAST(vm); } mutex_exit(vmem_list_lock);
CVS commit: src/sys/arch/amiga/pci
Module Name:src Committed By: para Date: Sun Jan 29 15:32:52 UTC 2012 Modified Files: src/sys/arch/amiga/pci: mppb.c p5pb.c Log Message: adapt to extent(9) changes To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/pci/mppb.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/pci/p5pb.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/arch/amiga/pci/mppb.c diff -u src/sys/arch/amiga/pci/mppb.c:1.5 src/sys/arch/amiga/pci/mppb.c:1.6 --- src/sys/arch/amiga/pci/mppb.c:1.5 Thu Jan 19 00:14:08 2012 +++ src/sys/arch/amiga/pci/mppb.c Sun Jan 29 15:32:52 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mppb.c,v 1.5 2012/01/19 00:14:08 rkujawa Exp $ */ +/* $NetBSD: mppb.c,v 1.6 2012/01/29 15:32:52 para Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -168,9 +168,9 @@ mppb_attach(device_t parent, device_t se #ifdef PCI_NETBSD_CONFIGURE ioext = extent_create(mppbio, MPPB_IO_BASE, - MPPB_IO_BASE + MPPB_IO_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); + MPPB_IO_BASE + MPPB_IO_SIZE, NULL, 0, EX_NOWAIT); memext = extent_create(mppbmem, MPPB_MEM_BASE, - MPPB_MEM_BASE + MPPB_MEM_SIZE, M_DEVBUF, NULL, 0, EX_NOWAIT); + MPPB_MEM_BASE + MPPB_MEM_SIZE, NULL, 0, EX_NOWAIT); #ifdef MPPB_DEBUG aprint_normal(mppb: reconfiguring the bus!\n); Index: src/sys/arch/amiga/pci/p5pb.c diff -u src/sys/arch/amiga/pci/p5pb.c:1.7 src/sys/arch/amiga/pci/p5pb.c:1.8 --- src/sys/arch/amiga/pci/p5pb.c:1.7 Tue Jan 24 00:20:45 2012 +++ src/sys/arch/amiga/pci/p5pb.c Sun Jan 29 15:32:52 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: p5pb.c,v 1.7 2012/01/24 00:20:45 rkujawa Exp $ */ +/* $NetBSD: p5pb.c,v 1.8 2012/01/29 15:32:52 para Exp $ */ /*- * Copyright (c) 2011, 2012 The NetBSD Foundation, Inc. @@ -452,11 +452,11 @@ p5pb_bus_reconfigure(struct p5pb_softc * pc = sc-apc; - ioext = extent_create(p5pbio, 0, P5BUS_PCI_IO_SIZE, M_DEVBUF, NULL, 0, - EX_NOWAIT); + ioext = extent_create(p5pbio, 0, P5BUS_PCI_IO_SIZE, NULL, 0, + EX_NOWAIT); memext = extent_create(p5pbmem, sc-pci_mem_lowest, - sc-pci_mem_highest, M_DEVBUF, NULL, 0, EX_NOWAIT); + sc-pci_mem_highest, NULL, 0, EX_NOWAIT); if ( (!ioext) || (!memext) ) return false;
CVS commit: src/sys/arch/sun3/sun3
Module Name:src Committed By: para Date: Sun Jan 29 16:24:01 UTC 2012 Modified Files: src/sys/arch/sun3/sun3: dvma.c Log Message: adapt to recent changes in uvm To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sun3/sun3/dvma.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/arch/sun3/sun3/dvma.c diff -u src/sys/arch/sun3/sun3/dvma.c:1.37 src/sys/arch/sun3/sun3/dvma.c:1.38 --- src/sys/arch/sun3/sun3/dvma.c:1.37 Fri Jan 27 18:53:03 2012 +++ src/sys/arch/sun3/sun3/dvma.c Sun Jan 29 16:24:01 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: dvma.c,v 1.37 2012/01/27 18:53:03 para Exp $ */ +/* $NetBSD: dvma.c,v 1.38 2012/01/29 16:24:01 para Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: dvma.c,v 1.37 2012/01/27 18:53:03 para Exp $); +__KERNEL_RCSID(0, $NetBSD: dvma.c,v 1.38 2012/01/29 16:24:01 para Exp $); #include sys/param.h #include sys/systm.h @@ -82,11 +82,13 @@ dvma_init(void) * dvma_extent manages things handled in interrupt * context. */ - phys_map = uvm_map_create(pmap_kernel(), - DVMA_MAP_BASE, DVMA_MAP_END, 0); + phys_map = kmem_alloc(sizeof(struct vm_map), KM_SLEEP); if (phys_map == NULL) panic(unable to create DVMA map); + uvm_map_setup(phys_map, DVMA_MAP_BASE, DVMA_MAP_END, 0); + phys_map-pmap = pmap_kernel(); + /* * Reserve the DVMA space used for segment remapping. * The remainder of phys_map is used for DVMA scratch
CVS commit: src/sys/arch/sun3/sun3
Module Name:src Committed By: para Date: Sun Jan 29 16:24:51 UTC 2012 Modified Files: src/sys/arch/sun3/sun3: pmap.c Log Message: convert from malloc(9) to kmem(9) To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/sys/arch/sun3/sun3/pmap.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/arch/sun3/sun3/pmap.c diff -u src/sys/arch/sun3/sun3/pmap.c:1.166 src/sys/arch/sun3/sun3/pmap.c:1.167 --- src/sys/arch/sun3/sun3/pmap.c:1.166 Fri Jun 3 17:03:53 2011 +++ src/sys/arch/sun3/sun3/pmap.c Sun Jan 29 16:24:51 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.166 2011/06/03 17:03:53 tsutsui Exp $ */ +/* $NetBSD: pmap.c,v 1.167 2012/01/29 16:24:51 para Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -80,7 +80,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.166 2011/06/03 17:03:53 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.167 2012/01/29 16:24:51 para Exp $); #include opt_ddb.h #include opt_pmap_debug.h @@ -88,7 +88,7 @@ __KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.1 #include sys/param.h #include sys/systm.h #include sys/proc.h -#include sys/malloc.h +#include sys/kmem.h #include sys/pool.h #include sys/queue.h #include sys/kcore.h @@ -1849,7 +1849,7 @@ void pmap_user_init(pmap_t pmap) { int i; - pmap-pm_segmap = malloc(sizeof(char)*NUSEG, M_VMPMAP, M_WAITOK); + pmap-pm_segmap = kmem_alloc(sizeof(char)*NUSEG, KM_SLEEP); for (i = 0; i NUSEG; i++) { pmap-pm_segmap[i] = SEGINV; } @@ -1900,7 +1900,7 @@ pmap_release(struct pmap *pmap) #endif context_free(pmap); } - free(pmap-pm_segmap, M_VMPMAP); + kmem_free(pmap-pm_segmap, sizeof(char)*NUSEG); pmap-pm_segmap = NULL; splx(s);
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sun Jan 29 11:14:50 UTC 2012 Modified Files: src/sys/kern: subr_extent.c Log Message: remove left over macro after kmem_map is gone To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/kern/subr_extent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sparc/sparc
Module Name:src Committed By: para Date: Sun Jan 29 11:49:58 UTC 2012 Modified Files: src/sys/arch/sparc/sparc: pmap.c Log Message: fix sparc after kmem_map is gone To generate a diff of this commit: cvs rdiff -u -r1.347 -r1.348 src/sys/arch/sparc/sparc/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/ufs/ufs
Module Name:src Committed By: para Date: Sun Jan 29 11:59:14 UTC 2012 Modified Files: src/sys/ufs/ufs: ufs_quota.c Log Message: sprinkel some #ifdef QUOTA2 to avoid unused variables To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/ufs/ufs/ufs_quota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: para Date: Sun Jan 29 12:37:01 UTC 2012 Modified Files: src/sys/uvm: uvm_km.c Log Message: size kmem_arena more sanely for small memory machines To generate a diff of this commit: cvs rdiff -u -r1.112 -r1.113 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.
CVS commit: src/sys/kern
Module Name:src Committed By: para Date: Sun Jan 29 13:38:15 UTC 2012 Modified Files: src/sys/kern: subr_vmem.c Log Message: move condvar calls under interlock protection call uvm_kick_pdaemon in case we can sleep and no space in arena To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/kern/subr_vmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amiga/pci
Module Name:src Committed By: para Date: Sun Jan 29 15:32:52 UTC 2012 Modified Files: src/sys/arch/amiga/pci: mppb.c p5pb.c Log Message: adapt to extent(9) changes To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/pci/mppb.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/pci/p5pb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sun3/sun3
Module Name:src Committed By: para Date: Sun Jan 29 16:24:01 UTC 2012 Modified Files: src/sys/arch/sun3/sun3: dvma.c Log Message: adapt to recent changes in uvm To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sun3/sun3/dvma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sun3/sun3
Module Name:src Committed By: para Date: Sun Jan 29 16:24:51 UTC 2012 Modified Files: src/sys/arch/sun3/sun3: pmap.c Log Message: convert from malloc(9) to kmem(9) To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/sys/arch/sun3/sun3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.