Jeremie Courreges-Anglas <[email protected]> writes:
> As proposed by mpi@ in
>
> http://marc.info/?l=openbsd-tech&m=148585429014645&w=2
>
> I think that choosing a "proper" type doesn't bring much information,
> and having one parameter less makes things simpler. mbuf counters move
> from M_DEVBUF to M_COUNTERS as a result, but I can't see a reason for
> those to be special.
>
> Comments / oks?
Manpage diff,
Index: counters_alloc.9
===================================================================
RCS file: /d/cvs/src/share/man/man9/counters_alloc.9,v
retrieving revision 1.9
diff -u -p -r1.9 counters_alloc.9
--- counters_alloc.9 14 Nov 2016 06:57:39 -0000 1.9
+++ counters_alloc.9 31 Jan 2017 12:26:29 -0000
@@ -34,16 +34,15 @@
.Sh SYNOPSIS
.In sys/percpu.h
.Ft struct cpumem *
-.Fn counters_alloc "unsigned int ncounters" "int type"
+.Fn counters_alloc "unsigned int ncounters"
.Ft void
-.Fn counters_free "struct cpumem *cm" "unsigned int ncounters" "int type"
+.Fn counters_free "struct cpumem *cm" "unsigned int ncounters"
.Fn COUNTERS_BOOT_MEMORY "NAME" "unsigned int ncounters"
.Fn COUNTERS_BOOT_INITIALIZER "NAME"
.Ft struct cpumemt *
.Fo counters_alloc_ncpus
.Fa "struct cpumem *cm"
.Fa "unsigned int ncounters"
-.Fa "int type"
.Fc
.Ft uint64_t *
.Fn counters_enter "struct counters_ref *ref" "struct cpumem *cm"
@@ -91,20 +90,13 @@ uni-processor systems.
allocates memory for a series of uint64_t values on each CPU.
.Fa ncounters
specifies the number of counters to be allocated.
-The
-.Fa type
-argument specifies the type of memory that the counters will be
-allocated as via
-.Xr malloc 9 .
The counters will be zeroed on allocation.
.Pp
.Fn counters_free
deallocates each CPU's counters.
The same
.Fa ncounters
-and
-.Fa type
-arguments type originally provided to
+argument originally provided to
.Fn counters_alloc
must be passed to
.Fn counters_free .
@@ -142,11 +134,6 @@ The same number of counters originally p
.Fa COUNTERS_BOOT_MEMORY
must be specified by
.Fa ncounters .
-The
-.Fa type
-argument specifies the type of memory that the counters will be
-allocated as via
-.Xr malloc 9 .
The counters on the boot CPU will be preserved, while the counters
for the additional CPUs will be zeroed on allocation.
.Pp
@@ -264,8 +251,7 @@ struct cpumem *mbstat = COUNTERS_BOOT_IN
void
mbcpuinit()
{
- mbstat = counters_alloc_ncpus(mbstat, MBSTAT_COUNT,
- M_DEVBUF);
+ mbstat = counters_alloc_ncpus(mbstat, MBSTAT_COUNT);
}
struct mbuf *
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE