diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2017-02-05 16:23:39 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2017-02-05 16:23:39 +0000 |
commit | c209894806b3b7e37931ecc68cb218a1893f8141 (patch) | |
tree | 94d883c5b19da9a8664b7a95306fee026a1f7175 /sys/kern/subr_percpu.c | |
parent | a0fe76973a89628bbcd7a93577076e67e111a4a4 (diff) |
Always allocate counters memory using type M_COUNTERS.
This makes the API simpler, and is probably more useful than spreading
counters memory other several types, making it harder to track.
Prodded by mpi, ok mpi@ stsp@
Diffstat (limited to 'sys/kern/subr_percpu.c')
-rw-r--r-- | sys/kern/subr_percpu.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/kern/subr_percpu.c b/sys/kern/subr_percpu.c index d009f646e9c..bcd4dd9bcd7 100644 --- a/sys/kern/subr_percpu.c +++ b/sys/kern/subr_percpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_percpu.c,v 1.6 2017/01/11 17:46:28 bluhm Exp $ */ +/* $OpenBSD: subr_percpu.c,v 1.7 2017/02/05 16:23:38 jca Exp $ */ /* * Copyright (c) 2016 David Gwynne <dlg@openbsd.org> @@ -125,7 +125,7 @@ cpumem_next(struct cpumem_iter *i, struct cpumem *cm) } struct cpumem * -counters_alloc(unsigned int n, int type) +counters_alloc(unsigned int n) { struct cpumem *cm; struct cpumem_iter cmi; @@ -135,7 +135,7 @@ counters_alloc(unsigned int n, int type) KASSERT(n > 0); n++; /* add space for a generation number */ - cm = cpumem_malloc(n * sizeof(uint64_t), type); + cm = cpumem_malloc(n * sizeof(uint64_t), M_COUNTERS); CPUMEM_FOREACH(counters, &cmi, cm) { for (i = 0; i < n; i++) @@ -146,17 +146,17 @@ counters_alloc(unsigned int n, int type) } struct cpumem * -counters_alloc_ncpus(struct cpumem *cm, unsigned int n, int type) +counters_alloc_ncpus(struct cpumem *cm, unsigned int n) { n++; /* the generation number */ - return (cpumem_malloc_ncpus(cm, n * sizeof(uint64_t), type)); + return (cpumem_malloc_ncpus(cm, n * sizeof(uint64_t), M_COUNTERS)); } void -counters_free(struct cpumem *cm, int type, unsigned int n) +counters_free(struct cpumem *cm, unsigned int n) { n++; /* generation number */ - cpumem_free(cm, type, n * sizeof(uint64_t)); + cpumem_free(cm, M_COUNTERS, n * sizeof(uint64_t)); } void @@ -284,24 +284,24 @@ cpumem_next(struct cpumem_iter *i, struct cpumem *cm) } struct cpumem * -counters_alloc(unsigned int n, int type) +counters_alloc(unsigned int n) { KASSERT(n > 0); - return (cpumem_malloc(n * sizeof(uint64_t), type)); + return (cpumem_malloc(n * sizeof(uint64_t), M_COUNTERS)); } struct cpumem * -counters_alloc_ncpus(struct cpumem *cm, unsigned int n, int type) +counters_alloc_ncpus(struct cpumem *cm, unsigned int n) { /* this is unecessary, but symmetrical */ - return (cpumem_malloc_ncpus(cm, n * sizeof(uint64_t), type)); + return (cpumem_malloc_ncpus(cm, n * sizeof(uint64_t), M_COUNTERS)); } void -counters_free(struct cpumem *cm, int type, unsigned int n) +counters_free(struct cpumem *cm, unsigned int n) { - cpumem_free(cm, type, n * sizeof(uint64_t)); + cpumem_free(cm, M_COUNTERS, n * sizeof(uint64_t)); } void |