Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175978737
D23570.id67937.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23570.id67937.diff
View Options
Index: sys/kern/subr_pcpu.c
===================================================================
--- sys/kern/subr_pcpu.c
+++ sys/kern/subr_pcpu.c
@@ -95,6 +95,7 @@
cpu_pcpu_init(pcpu, cpuid, size);
pcpu->pc_rm_queue.rmq_next = &pcpu->pc_rm_queue;
pcpu->pc_rm_queue.rmq_prev = &pcpu->pc_rm_queue;
+ pcpu->pc_zpcpu_offset = zpcpu_offset(cpuid);
}
void
Index: sys/sys/pcpu.h
===================================================================
--- sys/sys/pcpu.h
+++ sys/sys/pcpu.h
@@ -189,7 +189,7 @@
long pc_cp_time[CPUSTATES]; /* statclock ticks */
struct device *pc_device;
void *pc_netisr; /* netisr SWI cookie */
- int pc_unused1; /* unused field */
+ u_int pc_zpcpu_offset; /* Offset into zpcpu allocs */
int pc_domain; /* Memory domain. */
struct rm_queue pc_rm_queue; /* rmlock list of trackers */
uintptr_t pc_dynamic; /* Dynamic per-cpu data area */
@@ -227,14 +227,18 @@
#endif
#define curproc (curthread->td_proc)
+#define zpcpu_offset(cpu) (UMA_PCPU_ALLOC_SIZE * cpu)
+_Static_assert(zpcpu_offset(MAXCPU - 1) < (1<<20),
+ "zpcpu_offset may need to be revisited");
+
/* Accessor to elements allocated via UMA_ZONE_PCPU zone. */
#define zpcpu_get(base) ({ \
- __typeof(base) _ptr = (void *)((char *)(base) + UMA_PCPU_ALLOC_SIZE * curcpu); \
+ __typeof(base) _ptr = (void *)((char *)(base) + PCPU_GET(zpcpu_offset)); \
_ptr; \
})
#define zpcpu_get_cpu(base, cpu) ({ \
- __typeof(base) _ptr = (void *)((char *)(base) + UMA_PCPU_ALLOC_SIZE * cpu); \
+ __typeof(base) _ptr = (void *)((char *)(base) + zpcpu_offset(cpu)); \
_ptr; \
})
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 15, 11:45 PM (6 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40874474
Default Alt Text
D23570.id67937.diff (1 KB)
Attached To
Mode
D23570: Optimize zpcpu macros a little bit.
Attached
Detach File
Event Timeline
Log In to Comment