summaryrefslogtreecommitdiffstats
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2010-03-30 18:29:19 +0000
committerjhb <jhb@FreeBSD.org>2010-03-30 18:29:19 +0000
commit81e9dfe51bebaf025e2a674e72f112a6774c279f (patch)
treecb7ce911a16dc6626a91ecb7e10abaa054711b52 /sys/sys/pcpu.h
parent51ae37b9c139f8fbbb000b834832621b6462fcb4 (diff)
downloadFreeBSD-src-81e9dfe51bebaf025e2a674e72f112a6774c279f.zip
FreeBSD-src-81e9dfe51bebaf025e2a674e72f112a6774c279f.tar.gz
Various and sundry style, whitespace, and comment fixes.
Submitted by: bde (mostly)
Diffstat (limited to 'sys/sys/pcpu.h')
-rw-r--r--sys/sys/pcpu.h60
1 files changed, 25 insertions, 35 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index 250aa29..b5d3d77 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -42,22 +42,19 @@
#include <sys/resource.h>
#include <machine/pcpu.h>
-struct pcb;
-struct thread;
-
/*
* Define a set for pcpu data.
*
* We don't use SET_DECLARE because it defines the set as 'a' when we
- * want 'aw'. GCC considers uninitialized data in a seperate section
- * writable and there is no generic zero initializer that works for
+ * want 'aw'. gcc considers uninitialized data in a separate section
+ * writable, and there is no generic zero initializer that works for
* structs and scalars.
*/
extern uintptr_t *__start_set_pcpu;
extern uintptr_t *__stop_set_pcpu;
__asm__(
-#if defined(__arm__)
+#ifdef __arm__
".section set_pcpu, \"aw\", %progbits\n"
#else
".section set_pcpu, \"aw\", @progbits\n"
@@ -73,8 +70,8 @@ extern uintptr_t dpcpu_off[];
/*
* Convenience defines.
*/
-#define DPCPU_START (uintptr_t)&__start_set_pcpu
-#define DPCPU_STOP (uintptr_t)&__stop_set_pcpu
+#define DPCPU_START ((uintptr_t)&__start_set_pcpu)
+#define DPCPU_STOP ((uintptr_t)&__stop_set_pcpu)
#define DPCPU_BYTES (DPCPU_STOP - DPCPU_START)
#define DPCPU_MODMIN 2048
#define DPCPU_SIZE roundup2(DPCPU_BYTES, PAGE_SIZE)
@@ -111,8 +108,8 @@ extern uintptr_t dpcpu_off[];
/*
* XXXUPS remove as soon as we have per cpu variable
- * linker sets and can define rm_queue in _rm_lock.h
-*/
+ * linker sets and can define rm_queue in _rm_lock.h
+ */
struct rm_queue {
struct rm_queue* volatile rmq_next;
struct rm_queue* volatile rmq_prev;
@@ -120,7 +117,6 @@ struct rm_queue {
#define PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__XSTRING(MAXCPU) + 1))
-
/*
* This structure maps out the global data that needs to be kept on a
* per-cpu basis. The members are accessed via the PCPU_GET/SET/PTR
@@ -133,43 +129,40 @@ struct pcpu {
struct thread *pc_fpcurthread; /* Fp state owner */
struct thread *pc_deadthread; /* Zombie thread or NULL */
struct pcb *pc_curpcb; /* Current pcb */
- uint64_t pc_switchtime;
- int pc_switchticks;
+ uint64_t pc_switchtime; /* cpu_ticks() at last csw */
+ int pc_switchticks; /* `ticks' at last csw */
u_int pc_cpuid; /* This cpu number */
cpumask_t pc_cpumask; /* This cpu mask */
cpumask_t pc_other_cpus; /* Mask of all other cpus */
SLIST_ENTRY(pcpu) pc_allcpu;
struct lock_list_entry *pc_spinlocks;
#ifdef KTR
- char pc_name[PCPU_NAME_LEN]; /* String name for KTR. */
+ char pc_name[PCPU_NAME_LEN]; /* String name for KTR */
#endif
struct vmmeter pc_cnt; /* VM stats counters */
long pc_cp_time[CPUSTATES]; /* statclock ticks */
struct device *pc_device;
- void *pc_netisr; /* netisr SWI cookie. */
+ void *pc_netisr; /* netisr SWI cookie */
- /*
+ /*
* Stuff for read mostly lock
- *
+ *
* XXXUPS remove as soon as we have per cpu variable
* linker sets.
*/
- struct rm_queue pc_rm_queue;
+ struct rm_queue pc_rm_queue;
- /*
- * Dynamic per-cpu data area.
- */
- uintptr_t pc_dynamic;
+ uintptr_t pc_dynamic; /* Dynamic per-cpu data area */
/*
* Keep MD fields last, so that CPU-specific variations on a
* single architecture don't result in offset variations of
- * the machine-independent fields of the pcpu. Even though
+ * the machine-independent fields of the pcpu. Even though
* the pcpu structure is private to the kernel, some ports
- * (e.g. lsof, part of gtop) define _KERNEL and include this
- * header. While strictly speaking this is wrong, there's no
- * reason not to keep the offsets of the MI fields constant.
- * If only to make kernel debugging easier...
+ * (e.g., lsof, part of gtop) define _KERNEL and include this
+ * header. While strictly speaking this is wrong, there's no
+ * reason not to keep the offsets of the MI fields constant
+ * if only to make kernel debugging easier.
*/
PCPU_MD_FIELDS;
} __aligned(128);
@@ -179,6 +172,7 @@ struct pcpu {
SLIST_HEAD(cpuhead, pcpu);
extern struct cpuhead cpuhead;
+extern struct pcpu *cpuid_to_pcpu[MAXCPU];
#define curcpu PCPU_GET(cpuid)
#define curproc (curthread->td_proc)
@@ -193,21 +187,17 @@ extern struct cpuhead cpuhead;
* db_show_mdpcpu() is responsible for handling machine dependent
* fields for the DDB 'show pcpu' command.
*/
-
-extern struct pcpu *cpuid_to_pcpu[MAXCPU];
-
-
void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size);
void db_show_mdpcpu(struct pcpu *pcpu);
-void pcpu_destroy(struct pcpu *pcpu);
-struct pcpu *pcpu_find(u_int cpuid);
-void pcpu_init(struct pcpu *pcpu, int cpuid, size_t size);
void *dpcpu_alloc(int size);
void dpcpu_copy(void *s, int size);
void dpcpu_free(void *s, int size);
void dpcpu_init(void *dpcpu, int cpuid);
+void pcpu_destroy(struct pcpu *pcpu);
+struct pcpu *pcpu_find(u_int cpuid);
+void pcpu_init(struct pcpu *pcpu, int cpuid, size_t size);
-#endif /* _KERNEL */
+#endif /* _KERNEL */
#endif /* !_SYS_PCPU_H_ */
OpenPOWER on IntegriCloud