summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-05-18 07:10:50 +0000
committerjeff <jeff@FreeBSD.org>2007-05-18 07:10:50 +0000
commite1996cb9609d2e55a26ee78dddbfce4ba4073b53 (patch)
treec94b660d4b9246fed8cbeadf7851932258d8b72a /sys/kern/kern_malloc.c
parentbeb495eff1db0646624feb7071ced7f632ff8869 (diff)
downloadFreeBSD-src-e1996cb9609d2e55a26ee78dddbfce4ba4073b53.zip
FreeBSD-src-e1996cb9609d2e55a26ee78dddbfce4ba4073b53.tar.gz
- define and use VMCNT_{GET,SET,ADD,SUB,PTR} macros for manipulating
vmcnts. This can be used to abstract away pcpu details but also changes to use atomics for all counters now. This means sched lock is no longer responsible for protecting counts in the switch routines. Contributed by: Attilio Rao <attilio@FreeBSD.org>
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 19fbf30..6c9cf92 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -551,7 +551,7 @@ kmeminit(void *dummy)
* so make sure that there is enough space.
*/
vm_kmem_size = VM_KMEM_SIZE + nmbclusters * PAGE_SIZE;
- mem_size = cnt.v_page_count;
+ mem_size = VMCNT_GET(page_count);
#if defined(VM_KMEM_SIZE_SCALE)
vm_kmem_size_scale = VM_KMEM_SIZE_SCALE;
@@ -589,8 +589,8 @@ kmeminit(void *dummy)
* to something sane. Be careful to not overflow the 32bit
* ints while doing the check.
*/
- if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count)
- vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE;
+ if (((vm_kmem_size / 2) / PAGE_SIZE) > VMCNT_GET(page_count))
+ vm_kmem_size = 2 * VMCNT_GET(page_count) * PAGE_SIZE;
/*
* Tune settings based on the kernel map's size at this time.
@@ -650,7 +650,8 @@ malloc_init(void *data)
struct malloc_type_internal *mtip;
struct malloc_type *mtp;
- KASSERT(cnt.v_page_count != 0, ("malloc_register before vm_init"));
+ KASSERT(VMCNT_GET(page_count) != 0,
+ ("malloc_register before vm_init"));
mtp = data;
mtip = uma_zalloc(mt_zone, M_WAITOK | M_ZERO);
OpenPOWER on IntegriCloud