提交 7a4abfef 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

move cpus::hwid to a separate cache line to avoid false sharing,

as detected by mtrace. mapbench now has only one real cache line of unexpected sharing: "name": "tlbflush_req+0x0",
上级 80cdc1be
...@@ -11,7 +11,6 @@ extern atomic<u64> tlbflush_req; ...@@ -11,7 +11,6 @@ extern atomic<u64> tlbflush_req;
// Per-CPU state // Per-CPU state
struct cpu { struct cpu {
cpuid_t id; // Index into cpus[] below cpuid_t id; // Index into cpus[] below
hwid_t hwid; // Local APIC ID
int ncli; // Depth of pushcli nesting. int ncli; // Depth of pushcli nesting.
int intena; // Were interrupts enabled before pushcli? int intena; // Were interrupts enabled before pushcli?
struct segdesc gdt[NSEGS]; // x86 global descriptor table struct segdesc gdt[NSEGS]; // x86 global descriptor table
...@@ -22,6 +21,8 @@ struct cpu { ...@@ -22,6 +21,8 @@ struct cpu {
atomic<u64> tlbflush_done; // last tlb flush req done on this cpu atomic<u64> tlbflush_done; // last tlb flush req done on this cpu
struct proc *prev; // The previously-running process struct proc *prev; // The previously-running process
hwid_t hwid __mpalign__; // Local APIC ID, accessed by other CPUs
// Cpu-local storage variables; see below // Cpu-local storage variables; see below
struct cpu *cpu; struct cpu *cpu;
struct proc *proc; // The currently-running process. struct proc *proc; // The currently-running process.
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论