scheduler: Disable load tracking when not needed
This commit is contained in:
parent
db1ddabfd0
commit
e4ea637227
@ -136,6 +136,8 @@ scheduler_mode gCurrentModeID;
|
||||
scheduler_mode_operations* gCurrentMode;
|
||||
|
||||
bool gSingleCore;
|
||||
bool gCPUFrequencyManagement;
|
||||
bool gTrackLoad;
|
||||
|
||||
CPUEntry* gCPUEntries;
|
||||
|
||||
@ -533,7 +535,6 @@ reschedule(int32 nextState)
|
||||
|
||||
Thread* nextThread = nextThreadData->GetThread();
|
||||
ASSERT(!gCPU[thisCPU].disabled || thread_is_idle_thread(nextThread));
|
||||
|
||||
// update CPU heap
|
||||
CoreCPUHeapLocker cpuLocker(core);
|
||||
cpu->UpdatePriority(nextThreadData->GetEffectivePriority());
|
||||
@ -803,8 +804,16 @@ init()
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
gCoreCount = coreCount;
|
||||
// disable parts of the scheduler logic that are not needed
|
||||
gSingleCore = coreCount == 1;
|
||||
gCPUFrequencyManagement = increase_cpu_performance(0) == B_OK;
|
||||
gTrackLoad = !gSingleCore || gCPUFrequencyManagement;
|
||||
dprintf("scheduler switches: single core: %s, cpufreq: %s, load tracking:"
|
||||
" %s\n", gSingleCore ? "true" : "false",
|
||||
gCPUFrequencyManagement ? "true" : "false",
|
||||
gTrackLoad ? "true" : "false");
|
||||
|
||||
gCoreCount = coreCount;
|
||||
gPackageCount = packageCount;
|
||||
|
||||
gCPUEntries = new(std::nothrow) CPUEntry[cpuCount];
|
||||
|
@ -43,6 +43,8 @@ const int kVeryHighLoad = (kMaxLoad + kHighLoad) / 2;
|
||||
const int kLoadDifference = kMaxLoad * 20 / 100;
|
||||
|
||||
extern bool gSingleCore;
|
||||
extern bool gCPUFrequencyManagement;
|
||||
extern bool gTrackLoad;
|
||||
|
||||
|
||||
void init_debug_commands();
|
||||
|
@ -164,7 +164,6 @@ CPUEntry::ComputeLoad()
|
||||
{
|
||||
SCHEDULER_ENTER_FUNCTION();
|
||||
|
||||
ASSERT(!gSingleCore);
|
||||
ASSERT(fCPUNumber == smp_get_current_cpu());
|
||||
|
||||
int oldLoad = compute_load(fMeasureTime, fMeasureActiveTime, fLoad);
|
||||
@ -247,7 +246,7 @@ CPUEntry::TrackActivity(ThreadData* oldThreadData, ThreadData* nextThreadData)
|
||||
|
||||
oldThreadData->ComputeLoad();
|
||||
nextThreadData->ComputeLoad();
|
||||
if (!gSingleCore && !cpuEntry->disabled)
|
||||
if (gTrackLoad && !cpuEntry->disabled)
|
||||
ComputeLoad();
|
||||
|
||||
Thread* nextThread = nextThreadData->GetThread();
|
||||
@ -267,6 +266,9 @@ CPUEntry::_RequestPerformanceLevel(ThreadData* threadData)
|
||||
{
|
||||
SCHEDULER_ENTER_FUNCTION();
|
||||
|
||||
if (!gCPUFrequencyManagement)
|
||||
return;
|
||||
|
||||
if (gCPU[fCPUNumber].disabled) {
|
||||
decrease_cpu_performance(kCPUPerformanceScaleMax);
|
||||
return;
|
||||
|
@ -115,6 +115,24 @@ ThreadData::ChooseCoreAndCPU(CoreEntry*& targetCore, CPUEntry*& targetCPU)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ThreadData::ComputeLoad()
|
||||
{
|
||||
SCHEDULER_ENTER_FUNCTION();
|
||||
|
||||
if (!gTrackLoad)
|
||||
return;
|
||||
|
||||
if (fLastInterruptTime > 0) {
|
||||
bigtime_t interruptTime = gCPU[smp_get_current_cpu()].interrupt_time;
|
||||
interruptTime -= fLastInterruptTime;
|
||||
fMeasureActiveTime -= interruptTime;
|
||||
}
|
||||
|
||||
compute_load(fMeasureTime, fMeasureActiveTime, fLoad);
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
ThreadData::ComputeQuantum()
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
inline bool Dequeue();
|
||||
|
||||
inline void UpdateActivity(bigtime_t active);
|
||||
inline void ComputeLoad();
|
||||
void ComputeLoad();
|
||||
|
||||
inline bool HasQuantumEnded(bool wasPreempted, bool hasYielded);
|
||||
bigtime_t ComputeQuantum();
|
||||
@ -318,21 +318,6 @@ ThreadData::UpdateActivity(bigtime_t active)
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
ThreadData::ComputeLoad()
|
||||
{
|
||||
SCHEDULER_ENTER_FUNCTION();
|
||||
|
||||
if (fLastInterruptTime > 0) {
|
||||
bigtime_t interruptTime = gCPU[smp_get_current_cpu()].interrupt_time;
|
||||
interruptTime -= fLastInterruptTime;
|
||||
fMeasureActiveTime -= interruptTime;
|
||||
}
|
||||
|
||||
compute_load(fMeasureTime, fMeasureActiveTime, fLoad);
|
||||
}
|
||||
|
||||
|
||||
inline bool
|
||||
ThreadData::HasQuantumEnded(bool wasPreempted, bool hasYielded)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user