aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/pcpu.h
Commit message (Collapse)AuthorAgeFilesLines
* Dedup zpcpu assertions into one macro and guard the rest with #ifndefMateusz Guzik2020-02-121-3/+13
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=357806
* Store offset into zpcpu allocations in the per-cpu area.Mateusz Guzik2020-02-121-2/+17
| | | | | | | | | | This shorten zpcpu_get and allows more optimizations. Reviewed by: jeff Differential Revision: https://reviews.freebsd.org/D23570 Notes: svn path=/head/; revision=357804
* Tidy up zpcpu_replace*Mateusz Guzik2020-02-101-4/+13
| | | | | | | | | | - only compute the target address once - remove spurious type casting, zpcpu_get already return the correct type While here add missing newlines to other routines. Notes: svn path=/head/; revision=357728
* Add zpcpu_{set,add,sub}_protected.Mateusz Guzik2020-02-071-0/+18
| | | | | | | The _protected suffix follows counter(9). Notes: svn path=/head/; revision=357672
* Convert zpcpu_* inlines to macros and add zpcpu_replace.Mateusz Guzik2019-12-171-13/+15
| | | | | | | | This allows them to do basic type casting internally, effectively relieving consumers from having to cast on their own. Notes: svn path=/head/; revision=355855
* vfs: convert struct mount counters to per-cpuMateusz Guzik2019-09-161-0/+12
| | | | | | | | | | | | | | | | | | | | | There are 3 counters modified all the time in this structure - one for keeping the structure alive, one for preventing unmount and one for tracking active writers. Exact values of these counters are very rarely needed, which makes them a prime candidate for conversion to a per-cpu scheme, resulting in much better performance. Sample benchmark performing fstatfs (modifying 2 out of 3 counters) on a 104-way 2 socket Skylake system: before: 852393 ops/s after: 76682077 ops/s Reviewed by: kib, jeff Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21637 Notes: svn path=/head/; revision=352427
* Centralize __pcpu definitions.Konstantin Belousov2019-08-291-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Many extern struct pcpu <something>__pcpu declarations were copied/pasted in sources. The issue is that the definition is MD, but it cannot be provided by machine/pcpu.h due to actual struct pcpu defined in sys/pcpu.h later than the inclusion of machine/pcpu.h. This forced the copying when other code needed direct access to __pcpu. There is no way around it, due to machine/pcpu.h supplying part of struct pcpu fields. To work around the problem, add a new machine/pcpu_aux.h header, which should fill any needed MD definitions after struct pcpu definition is completed. This allows to remove copies of __pcpu spread around the source. Also on x86 it makes it possible to remove work arounds like OFFSETOF_CURTHREAD or clang specific warnings supressions. Reported and tested by: lwhsu, bcran Reviewed by: imp, markj (previous version) Discussed with: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21418 Notes: svn path=/head/; revision=351594
* Move scheduler state into the per-cpu area where it can be allocated on theJeff Roberson2019-08-131-0/+1
| | | | | | | | | | | correct NUMA domain. Reviewed by: markj, gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D19315 Notes: svn path=/head/; revision=350972
* [PowerPC64] Don't mark module data as staticLeandro Lupori2019-06-251-1/+2
| | | | | | | | | | | | | | | | | | | | Fixes panic when loading ipfw.ko and if_epair.ko built with modern compiler. Similar to arm64 and riscv, when using a modern compiler (!gcc4.2), code generated tries to access data in the wrong location, causing kernel panic (data storage interrupt trap) when loading if_epair and ipfw. Issue was reproduced with kernel/module compiled using gcc8 and clang8. It affects both ELFv1 and ELFv2 ABI environments. PR: 232387 Submitted by: alfredo.junior_eldorado.org.br Reported by: Mark Millard Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20461 Notes: svn path=/head/; revision=349377
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Don't mark module data as static on RISC-V.Ruslan Bukin2018-09-121-1/+1
| | | | | | | | | | | | | Similar to arm64, riscv compiler uses PC-relative loads/stores, and with static data compiler does not emit relocations. In result, kernel module linker has nothing to fix and data accessed from the wrong location. Approved by: re (gjb) Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=338608
* As with DPCPU_DEFINE_STATIC make VNET_DEFINE_STATIC non-static on arm64 inAndrew Turner2018-07-301-1/+3
| | | | | | | | | | | modules. It also fails in the same way, we are unable to relocate static variables as the compiler uses PC-relative loads with nothing for the kernel linker to relocate. Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=336909
* Don't use the static keyword with DPCPU defines in arm64 modules.Andrew Turner2018-07-161-0/+18
| | | | | | | | | | | | | | | | | | | | | | On arm64 compiler will create PC-relative loads and stores for static data. This means it doesn't emit a relocation. Unfortunately the in-kernel linker expects there to be one for DPCPU defines so it can modify its value so the code will use the correct DPCPU region. To workaround the lack of a relocation with static data remove it when building modules on arm64. The kernel is unaffected as it doesn't rely on modifying these relocations to find the data. PR: 225684 Reported by: Johannes Lundberg <johalun0@gmail.com> Reported by: Jose Luis Duran <jlduran@gmail.com> Reported by: Greg V <greg@unrelenting.technology> Reviewed by: bz Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D16145 Notes: svn path=/head/; revision=336349
* Expand x86 struct pcpus to UMA_PCPU_ALLOC_SIZE AKA PAGE_SIZE.Konstantin Belousov2018-07-061-8/+13
| | | | | | | | | | | | This restores counters(9) operation. Revert r336024. Improve assert of pcpu size on x86. Reviewed by: mmacy Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D16163 Notes: svn path=/head/; revision=336047
* Revert to recommit with the proper message.Konstantin Belousov2018-07-061-13/+8
| | | | Notes: svn path=/head/; revision=336046
* Save a call to pmap_remove() if entry cannot have any pages mapped.Konstantin Belousov2018-07-061-8/+13
| | | | | | | | | | | | | | | | Due to the way rtld creates mappings for the shared objects, each dso causes unmap of at least three guard map entries. For instance, in the buildworld load, this change reduces the amount of pmap_remove() calls by 1/5. Profiled by: alc Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D16148 Notes: svn path=/head/; revision=336045
* Back pcpu zone with domain correct pagesMatt Macy2018-07-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | - Change pcpu zone consumers to use a stride size of PAGE_SIZE. (defined as UMA_PCPU_ALLOC_SIZE to make future identification easier) - Allocate page from the correct domain for a given cpu. - Don't initialize pc_domain to non-zero value if NUMA is not defined There are some misconceptions surrounding this field. It is the _VM_ NUMA domain and should only ever correspond to valid domain values as understood by the VM. The former slab size of sizeof(struct pcpu) was somewhat arbitrary. The new value is PAGE_SIZE because that's the smallest granularity which the VM can allocate a slab for a given domain. If you have fewer than PAGE_SIZE/8 counters on your system there will be some memory wasted, but this is obviously something where you want the cache line to be coming from the correct domain. Reviewed by: jeff Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15933 Notes: svn path=/head/; revision=336020
* Create a new macro for static DPCPU data.Andrew Turner2018-07-051-1/+5
| | | | | | | | | | | | | | | | | On arm64 (and possible other architectures) we are unable to use static DPCPU data in kernel modules. This is because the compiler will generate PC-relative accesses, however the runtime-linker expects to be able to relocate these. In preparation to fix this create two macros depending on if the data is global or static. Reviewed by: bz, emaste, markj Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D16140 Notes: svn path=/head/; revision=336007
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* - Remove 'struct vmmeter' from 'struct pcpu', leaving only global vmmeterGleb Smirnoff2017-04-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | in place. To do per-cpu stats, convert all fields that previously were maintained in the vmmeters that sit in pcpus to counter(9). - Since some vmmeter stats may be touched at very early stages of boot, before we have set up UMA and we can do counter_u64_alloc(), provide an early counter mechanism: o Leave one spare uint64_t in struct pcpu, named pc_early_dummy_counter. o Point counter(9) fields of vmmeter to pcpu[0].pc_early_dummy_counter, so that at early stages of boot, before counters are allocated we already point to a counter that can be safely written to. o For sparc64 that required a whole dummy pcpu[MAXCPU] array. Further related changes: - Don't include vmmeter.h into pcpu.h. - vm.stats.vm.v_swappgsout and vm.stats.vm.v_swappgsin changed to 64-bit, to match kernel representation. - struct vmmeter hidden under _KERNEL, and only vmstat(1) is an exclusion. This is based on benno@'s 4-year old patch: https://lists.freebsd.org/pipermail/freebsd-arch/2013-July/014471.html Reviewed by: kib, gallatin, marius, lidl Differential Revision: https://reviews.freebsd.org/D10156 Notes: svn path=/head/; revision=317061
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* sys/pcpu.h: Revert change introduced in r303890Jean-Sébastien Pédron2016-08-091-1/+1
| | | | | | | | | | | | | | | `device_t` is not defined outside the kernel but this header is used by eg. libkvm or vmstat(8). Thus, r303890 broke the build. So let's restore `struct device` here until a longer term solution is found. Reported by: Michael Butler <imb@protected-networks.net>, Jenkins MFC after: 3 days MFC with: r303890 Notes: svn path=/head/; revision=303895
* Consistently use `device_t`Jean-Sébastien Pédron2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | Several files use the internal name of `struct device` instead of `device_t` which is part of the public API. This patch changes all `struct device *` to `device_t`. The remaining occurrences of `struct device` are those referring to the Linux or OpenBSD version of the structure, or the code is not built on FreeBSD and it's unclear what to do. Submitted by: Matthew Macy <mmacy@nextbsd.org> (previous version) Approved by: emaste, jhibbits, sbruno MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D7447 Notes: svn path=/head/; revision=303890
* Revert r299096Enji Cooper2016-05-051-1/+1
| | | | | | | | | | | | | | The change broke buildworld when building lib/libkvm This change likely needs to be run through a ports -exp run as a sanity check, as it might break downstream consumers. Pointyhat to: adrian Reported by: kargl (confirmed on $work workstation) Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=299108
* s/struct device */device_t/gAdrian Chadd2016-05-041-1/+1
| | | | | | | Submitted by: kmacy Notes: svn path=/head/; revision=299096
* Remove weighted page handling from vm_page_advise().Mark Johnston2015-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | This was added in r51337 as part of the implementation of madvise(MADV_DONTNEED). Its objective was to ensure that the page daemon would eventually reclaim other unreferenced pages (i.e., unreferenced pages not touched by madvise()) from the active queue. Now that the pagedaemon performs steady scanning of the active page queue, this weighted handling is unnecessary. Instead, always "cache" clean pages by moving them to the head of the inactive page queue. This simplifies the implementation of vm_page_advise() and eliminates the fragmentation that resulted from the distribution of pages among multiple queues. Suggested by: alc Reviewed by: alc Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3401 Notes: svn path=/head/; revision=287235
* Add zpcpu_get_cpu() that converts base pointer of UMA_ZPCPU_ZONEGleb Smirnoff2014-02-101-0/+7
| | | | | | | | | to a pointer private to a given cpuid. Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=261722
* Merge from projects/counters:Gleb Smirnoff2013-04-081-0/+16
| | | | | | | | | | Pad struct pcpu so that its size is denominator of PAGE_SIZE. This is done to reduce memory waste in UMA_PCPU_ZONE zones. Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=249265
* Remove namespace pollution in _rmlock.h by defining rm_queue structureAttilio Rao2012-09-181-18/+5
| | | | | | | | | | | | | | | | | directly in _rmlock.h and then including it (and its dependencies) in pcpu.h. This leads to few _*.h headers to be included in pcpu.h but this is not considered a big deal. Really pc_rm_queue should be implemented as a dynamic member with DPCPU interface, but we really want to keep the read acquisition as fast as possible, so even the further pc_dynamic indirection should be avoided, and the pollution is dealt like this. Discussed with: jhb MFC after: 1 week Notes: svn path=/head/; revision=240624
* Remove explicit MAXCPU usage from sys/pcpu.h avoiding a namespaceAttilio Rao2011-07-191-3/+1
| | | | | | | | | | | | | pollution. That is a step further in the direction of building correct policies for userland and modules on how to deal with the number of maxcpus at runtime. Reported by: jhb Reviewed and tested by: pluknet Approved by: re (kib) Notes: svn path=/head/; revision=224221
* Remove pc_name member of struct pcpu.Attilio Rao2011-07-191-3/+0
| | | | | | | | | | | | | | pc_name is only included when KTR option is and it does introduce a subdle KBI breakage that totally breaks vmstat when world and kernel are not in sync. Besides, it is not used somewhere. In collabouration with: pluknet Reviewed by: jhb Approved by: re (kib) Notes: svn path=/head/; revision=224218
* Fix the definition for PCPU_NAME_LEN, which is intended to fitMarius Strobl2011-07-091-1/+1
| | | | | | | | | | | | | | | | | | | ("CPU %d", cpuid) where cpuid <= MAXCPU. 1. sizeof(__XSTRING(MAXCPU) + 1) is a typo: typeof(__XSTRING(...) + 1) is 'char *', so sizeof() will return the size of the pointer, not the size of the string contents. The proper expression should be 'sizeof(__XSTRING(MAXCPU)) + 1'. 2. One should not add one, but substract it: sizeof() accounts for the trailing '\0' and we have two sizeof's, so the size of one '\0' should be substracted -- this will give the maximal string buffer length for CPU with its number, no less, no more. Submitted by: rea Notes: svn path=/head/; revision=223893
* Completely remove now unused pc_other_cpus, pc_cpumask.Attilio Rao2011-07-041-12/+0
| | | | | | | Tested by: pluknet Notes: svn path=/projects/largeSMP/; revision=223756
* MFCAttilio Rao2011-05-311-2/+2
|\ | | | | | | Notes: svn path=/projects/largeSMP/; revision=222548
| * On multi-core, multi-threaded PPC systems, it is important that the threadsNathan Whitehorn2011-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | be brought up in the order they are enumerated in the device tree (in particular, that thread 0 on each core be brought up first). The SLIST through which we loop to start the CPUs has all of its entries added with SLIST_INSERT_HEAD(), which means it is in reverse order of enumeration and so AP startup would always fail in such situations (causing a machine check or RTAS failure). Fix this by changing the SLIST into an STAILQ, and inserting new CPUs at the end. Reviewed by: jhb Notes: svn path=/head/; revision=222531
* | In the near future cpuset_t objects in struct pcpu will be axed out, butAttilio Rao2011-05-271-2/+12
| | | | | | | | | | | | | | | | | | | | | | as long as this does not happen, we need to fix interfaces to userland in order to not break run-time accesses to the structure. Reviwed by: kib Tested by: pluknet Notes: svn path=/projects/largeSMP/; revision=222360
* | Commit the support for removing cpumask_t and replacing it directly withAttilio Rao2011-05-051-2/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cpuset_t objects. That is going to offer the underlying support for a simple bump of MAXCPU and then support for number of cpus > 32 (as it is today). Right now, cpumask_t is an int, 32 bits on all our supported architecture. cpumask_t on the other side is implemented as an array of longs, and easilly extendible by definition. The architectures touched by this commit are the following: - amd64 - i386 - pc98 - arm - ia64 - XEN while the others are still missing. Userland is believed to be fully converted with the changes contained here. Some technical notes: - This commit may be considered an ABI nop for all the architectures different from amd64 and ia64 (and sparc64 in the future) - per-cpu members, which are now converted to cpuset_t, needs to be accessed avoiding migration, because the size of cpuset_t should be considered unknown - size of cpuset_t objects is different from kernel and userland (this is primirally done in order to leave some more space in userland to cope with KBI extensions). If you need to access kernel cpuset_t from the userland please refer to example in this patch on how to do that correctly (kgdb may be a good source, for example). - Support for other architectures is going to be added soon - Only MAXCPU for amd64 is bumped now The patch has been tested by sbruno and Nicholas Esborn on opteron 4 x 12 pack CPUs. More testing on big SMP is expected to came soon. pluknet tested the patch with his 8-ways on both amd64 and i386. Tested by: pluknet, sbruno, gianni, Nicholas Esborn Reviewed by: jeff, jhb, sbruno Notes: svn path=/projects/largeSMP/; revision=221499
* After some off-list discussion, revert a number of changes to theDimitry Andric2010-11-221-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various people working on the affected files. A better long-term solution is still being considered. This reversal may give some modules empty set_pcpu or set_vnet sections, but these are harmless. Changes reverted: ------------------------------------------------------------------------ r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines Instead of unconditionally emitting .globl's for the __start_set_xxx and __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. ------------------------------------------------------------------------ r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout the tree. ------------------------------------------------------------------------ r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE. Notes: svn path=/head/; revision=215701
* Instead of unconditionally emitting .globl's for the __start_set_xxx andDimitry Andric2010-11-141-3/+4
| | | | | | | | __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. Notes: svn path=/head/; revision=215318
* Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE.Dimitry Andric2010-11-141-0/+2
| | | | Notes: svn path=/head/; revision=215316
* Similar to sys/net/vnet.h, define the linker set name for sys/sys/pcpu.hDimitry Andric2010-11-141-1/+4
| | | | | | | as a macro, and use it instead of literal strings. Notes: svn path=/head/; revision=215315
* Use the same treatment as in linker_set.h for the __start and __stopDimitry Andric2010-11-111-0/+6
| | | | | | | | | | | | | | symbols of the set_vnet and set_pcpu sections, so those symbols will always be emitted in kernel modules, if they use vnet.h or pcpu.h. Also, for pcpu.h, make the __(start|stop)_set_pcpu declarations, and associated macros invisible to userland, to prevent it picking up these symbols. Reviewed by: kib Notes: svn path=/head/; revision=215138
* sys/pcpu.h: remove a workaround for a fixed ld bugAndriy Gapon2010-09-151-14/+0
| | | | | | | | | | | | | | | | | | | | | | The workaround was incorrectly documented as having something to do with set_pcpu section's progbits, but in fact it was for incorrect placement of __start_set_pcpu because of the bug in ld. The bug was fixed in r210245, see commit message for details. A side-effect of the workaround was that a zero-size set_pcpu section was produced for modules, source code of which included pcpu.h but didn't actually define any dynamic per-cpu variables. This commit should remove the side-effect. The same workaround is present sys/net/vnet.h, has an analogous side-effect and can be removed as well. An UPDATING entry that warns about a need for recent ld is following. MFC after: 1 month Notes: svn path=/head/; revision=212647
* Very rough first cut at NUMA support for the physical page allocator. ForJohn Baldwin2010-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | now it uses a very dumb first-touch allocation policy. This will change in the future. - Each architecture indicates the maximum number of supported memory domains via a new VM_NDOMAIN parameter in <machine/vmparam.h>. - Each cpu now has a PCPU_GET(domain) member to indicate the memory domain a CPU belongs to. Domain values are dense and numbered from 0. - When a platform supports multiple domains, the default freelist (VM_FREELIST_DEFAULT) is split up into N freelists, one for each domain. The MD code is required to populate an array of mem_affinity structures. Each entry in the array defines a range of memory (start and end) and a domain for the range. Multiple entries may be present for a single domain. The list is terminated by an entry where all fields are zero. This array of structures is used to split up phys_avail[] regions that fall in VM_FREELIST_DEFAULT into per-domain freelists. - Each memory domain has a separate lookup-array of freelists that is used when fulfulling a physical memory allocation. Right now the per-domain freelists are listed in a round-robin order for each domain. In the future a table such as the ACPI SLIT table may be used to order the per-domain lookup lists based on the penalty for each memory domain relative to a specific domain. The lookup lists may be examined via a new vm.phys.lookup_lists sysctl. - The first-touch policy is implemented by using PCPU_GET(domain) to pick a lookup list when allocating memory. Reviewed by: alc Notes: svn path=/head/; revision=210550
* Unbreak DPCPU_SUM() by dereferencing the pointer returned by DPCPU_ID_PTR().Lawrence Stewart2010-07-171-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=210184
* - The sum variable used in DPCPU_SUM needs to be of the same type as theLawrence Stewart2010-07-131-3/+2
| | | | | | | | | | | | | | | DPCPU variable, rather than a pointer to the type. - Zero # bytes equivalent to sizeof(object), not sizeof(ptr_to_object). - Remove an unnecessary __typeof. Sponsored by: FreeBSD Foundation Submitted by: jmallet MFC after: 3 days Notes: svn path=/head/; revision=209987
* Macro to simplify zeroing DPCPU variables.Lawrence Stewart2010-07-131-0/+9
| | | | | | | | Sponsored by: FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=209981
* - Rename DPCPU_SUM to DPCPU_VARSUM to better reflect the fact it operates onLawrence Stewart2010-07-131-1/+13
| | | | | | | | | | | | member variables of a DPCPU struct. - Add DPCPU_SUM which sums a DPCPU variable. Sponsored by: FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=209978
* - Rename the internal for loop iterator to "_i" to avoid potential shadowing ofLawrence Stewart2010-06-191-7/+11
| | | | | | | | | | | | | | | | | | | external variables named "i". The "_" prefix is reserved for infrastructure type code and is therefore not expected to be used by normal code likely to call DPCPU_SUM(). [1] - Change DPCPU_SUM to return the sum rather than calculate and assign it internally. Usage is now: "sum = DPCPU_SUM(dpcpu_var, member_to_sum);" [2] - Fix some style nits. [3] Sponsored by: FreeBSD Foundation Suggested by: bde [3], mdf [1], kib [1,2], pjd [1,3] Reviewed by: kib MFC after: 1 week (instead of r209119) Notes: svn path=/head/; revision=209325
* Add a utility macro to simplify calculating an aggregate sum from a DPCPULawrence Stewart2010-06-131-0/+11
| | | | | | | | | | | counter variable. Sponsored by: FreeBSD Foundation Reviewed by: jhb, rpaulo, rwatson (previous version of patch) MFC after: 1 week Notes: svn path=/head/; revision=209119