K 10 svn:author V 7 glebius K 8 svn:date V 27 2012-11-23T13:47:41.985848Z K 7 svn:log V 975 Prototype a simple API for per-cpu counters, right now only 64-bit. A counter can be allocated, zeroed, freed, incremented and decremented. The incremention/decremention functions are going to MD. Right now amd64 implementation is put into MI file, while the project branch is pre-alpha state. A dummy implementation on 64-bit arch would pin to current CPU, calculate address of counter for this cpu, update it and unpin. We may provide a racy non-pinning interface, that can lead the update going to other's CPU counter. A smart implementation for amd64 does a one-instruction update, thus doesn't require any pinning. This is achieved due to the fact that UMA_ZONE_PCPU zone guarantees us that per-cpu counters are aligned by the size of struct pcpu from each other. And we have address of static struct pcpu in %gs register always. This nice implementation is submitted by kib@. Implementation for 32-bit arches would require critical section for update. END