diff --git a/src/system/kernel/scheduler/scheduler.cpp b/src/system/kernel/scheduler/scheduler.cpp index 6f7a2bf050..84bcbfa2eb 100644 --- a/src/system/kernel/scheduler/scheduler.cpp +++ b/src/system/kernel/scheduler/scheduler.cpp @@ -45,6 +45,9 @@ #endif +#define CACHE_LINE_ALIGN __attribute__((aligned(64))) + + SchedulerListenerList gSchedulerListeners; spinlock gSchedulerListenersLock = B_SPINLOCK_INITIALIZER; @@ -87,8 +90,9 @@ struct CPUEntry : public MinMaxHeapLinkImpl { bigtime_t fMeasureTime; int fLoad; -}; -typedef MinMaxHeap CPUHeap; +} CACHE_LINE_ALIGN; +typedef MinMaxHeap CPUHeap CACHE_LINE_ALIGN; + static CPUEntry* sCPUEntries; static CPUHeap* sCPUPriorityHeaps; @@ -106,17 +110,16 @@ struct CoreEntry : public DoublyLinkedListLinkImpl { bigtime_t fActiveTime; int fLoad; -}; - -static CoreEntry* sCoreEntries; +} CACHE_LINE_ALIGN; typedef Heap, HeapMemberGetLink > CorePriorityHeap; -static CorePriorityHeap* sCorePriorityHeap; - typedef MinMaxHeap, MinMaxHeapMemberGetLink > CoreLoadHeap; + +static CoreEntry* sCoreEntries; +static CorePriorityHeap* sCorePriorityHeap; static CoreLoadHeap* sCoreLoadHeap; static CoreLoadHeap* sCoreHighLoadHeap; @@ -137,7 +140,7 @@ struct PackageEntry : public MinMaxHeapLinkImpl, int32 fIdleCoreCount; int32 fCoreCount; -}; +} CACHE_LINE_ALIGN; typedef MinMaxHeap PackageHeap; typedef DoublyLinkedList IdlePackageList; @@ -150,8 +153,9 @@ static IdlePackageList* sIdlePackageList; // logical processor has its sPinnedRunQueues used for scheduling // pinned threads. typedef RunQueue ThreadRunQueue; -static ThreadRunQueue* sRunQueues; -static ThreadRunQueue* sPinnedRunQueues; + +static ThreadRunQueue* sRunQueues CACHE_LINE_ALIGN; +static ThreadRunQueue* sPinnedRunQueues CACHE_LINE_ALIGN; static int32 sRunQueueCount; // 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* sCPUToPackage; - struct scheduler_thread_data { scheduler_thread_data() { Init(); } inline void Init();