Page MenuHomeFreeBSD

D23570.id67937.diff
No OneTemporary

D23570.id67937.diff

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

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)

Event Timeline