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"
 

Reply via email to