On 9 November 2016 at 10:51, Martin Pieuchot <m...@openbsd.org> wrote: > On 09/11/16(Wed) 14:55, David Gwynne wrote: >> since counters are an array of uint64_t values, this uses an enum >> to list the indexes into such an array. >> >> we still export an ipstat struct to userland (which you can see >> with netstat -sp ip). the export cheats a bit because we know that >> the struct is a collection of u_longs, so we just iterate over the >> coutners and the struct as an array and assign values. > > What about introducing a new type for counters instead of using M_PCB? > > This way we can easily track how much memory we use for per-CPU > counters. > >> ok? > > ok mpi@ >
In principle, I agree with mpi that M_PCB is not the right type, but if you introduce an M_COUNTER type would anyone need to pass any other type to the counters_alloc? I'm also a bit on the fence regarding lowecase enum elements, but it looks cool, so why the heck not :)