scheduler: Reduce false sharing of per-CPU and per-core data
This commit is contained in:
parent
a1feba678d
commit
d17b71d6b0
@ -45,6 +45,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define CACHE_LINE_ALIGN __attribute__((aligned(64)))
|
||||||
|
|
||||||
|
|
||||||
SchedulerListenerList gSchedulerListeners;
|
SchedulerListenerList gSchedulerListeners;
|
||||||
spinlock gSchedulerListenersLock = B_SPINLOCK_INITIALIZER;
|
spinlock gSchedulerListenersLock = B_SPINLOCK_INITIALIZER;
|
||||||
|
|
||||||
@ -87,8 +90,9 @@ struct CPUEntry : public MinMaxHeapLinkImpl<CPUEntry, int32> {
|
|||||||
bigtime_t fMeasureTime;
|
bigtime_t fMeasureTime;
|
||||||
|
|
||||||
int fLoad;
|
int fLoad;
|
||||||
};
|
} CACHE_LINE_ALIGN;
|
||||||
typedef MinMaxHeap<CPUEntry, int32> CPUHeap;
|
typedef MinMaxHeap<CPUEntry, int32> CPUHeap CACHE_LINE_ALIGN;
|
||||||
|
|
||||||
static CPUEntry* sCPUEntries;
|
static CPUEntry* sCPUEntries;
|
||||||
static CPUHeap* sCPUPriorityHeaps;
|
static CPUHeap* sCPUPriorityHeaps;
|
||||||
|
|
||||||
@ -106,17 +110,16 @@ struct CoreEntry : public DoublyLinkedListLinkImpl<CoreEntry> {
|
|||||||
bigtime_t fActiveTime;
|
bigtime_t fActiveTime;
|
||||||
|
|
||||||
int fLoad;
|
int fLoad;
|
||||||
};
|
} CACHE_LINE_ALIGN;
|
||||||
|
|
||||||
static CoreEntry* sCoreEntries;
|
|
||||||
typedef Heap<CoreEntry, int32, HeapLesserCompare<int32>,
|
typedef Heap<CoreEntry, int32, HeapLesserCompare<int32>,
|
||||||
HeapMemberGetLink<CoreEntry, int32, &CoreEntry::fPriorityHeapLink> >
|
HeapMemberGetLink<CoreEntry, int32, &CoreEntry::fPriorityHeapLink> >
|
||||||
CorePriorityHeap;
|
CorePriorityHeap;
|
||||||
static CorePriorityHeap* sCorePriorityHeap;
|
|
||||||
|
|
||||||
typedef MinMaxHeap<CoreEntry, int, MinMaxHeapCompare<int>,
|
typedef MinMaxHeap<CoreEntry, int, MinMaxHeapCompare<int>,
|
||||||
MinMaxHeapMemberGetLink<CoreEntry, int, &CoreEntry::fLoadHeapLink> >
|
MinMaxHeapMemberGetLink<CoreEntry, int, &CoreEntry::fLoadHeapLink> >
|
||||||
CoreLoadHeap;
|
CoreLoadHeap;
|
||||||
|
|
||||||
|
static CoreEntry* sCoreEntries;
|
||||||
|
static CorePriorityHeap* sCorePriorityHeap;
|
||||||
static CoreLoadHeap* sCoreLoadHeap;
|
static CoreLoadHeap* sCoreLoadHeap;
|
||||||
static CoreLoadHeap* sCoreHighLoadHeap;
|
static CoreLoadHeap* sCoreHighLoadHeap;
|
||||||
|
|
||||||
@ -137,7 +140,7 @@ struct PackageEntry : public MinMaxHeapLinkImpl<PackageEntry, int32>,
|
|||||||
int32 fIdleCoreCount;
|
int32 fIdleCoreCount;
|
||||||
|
|
||||||
int32 fCoreCount;
|
int32 fCoreCount;
|
||||||
};
|
} CACHE_LINE_ALIGN;
|
||||||
typedef MinMaxHeap<PackageEntry, int32> PackageHeap;
|
typedef MinMaxHeap<PackageEntry, int32> PackageHeap;
|
||||||
typedef DoublyLinkedList<PackageEntry> IdlePackageList;
|
typedef DoublyLinkedList<PackageEntry> IdlePackageList;
|
||||||
|
|
||||||
@ -150,8 +153,9 @@ static IdlePackageList* sIdlePackageList;
|
|||||||
// logical processor has its sPinnedRunQueues used for scheduling
|
// logical processor has its sPinnedRunQueues used for scheduling
|
||||||
// pinned threads.
|
// pinned threads.
|
||||||
typedef RunQueue<Thread, THREAD_MAX_SET_PRIORITY> ThreadRunQueue;
|
typedef RunQueue<Thread, THREAD_MAX_SET_PRIORITY> ThreadRunQueue;
|
||||||
static ThreadRunQueue* sRunQueues;
|
|
||||||
static ThreadRunQueue* sPinnedRunQueues;
|
static ThreadRunQueue* sRunQueues CACHE_LINE_ALIGN;
|
||||||
|
static ThreadRunQueue* sPinnedRunQueues CACHE_LINE_ALIGN;
|
||||||
static int32 sRunQueueCount;
|
static int32 sRunQueueCount;
|
||||||
|
|
||||||
// Since CPU IDs used internally by the kernel bear no relation to the actual
|
// Since CPU IDs used internally by the kernel bear no relation to the actual
|
||||||
@ -160,7 +164,6 @@ static int32 sRunQueueCount;
|
|||||||
static int32* sCPUToCore;
|
static int32* sCPUToCore;
|
||||||
static int32* sCPUToPackage;
|
static int32* sCPUToPackage;
|
||||||
|
|
||||||
|
|
||||||
struct scheduler_thread_data {
|
struct scheduler_thread_data {
|
||||||
scheduler_thread_data() { Init(); }
|
scheduler_thread_data() { Init(); }
|
||||||
inline void Init();
|
inline void Init();
|
||||||
|
Loading…
Reference in New Issue
Block a user