kernel: Relax cpu_ent::interrupt_time locking
The value isn't accessed by the other CPUs and all writes and reads are done with interrupts disabled.
This commit is contained in:
@@ -359,14 +359,16 @@ int_io_interrupt_handler(int vector, bool levelTriggered)
|
|||||||
if (!sVectors[vector].no_lock_vector)
|
if (!sVectors[vector].no_lock_vector)
|
||||||
release_spinlock(&sVectors[vector].vector_lock);
|
release_spinlock(&sVectors[vector].vector_lock);
|
||||||
|
|
||||||
SpinLocker locker(sVectors[vector].load_lock);
|
SpinLocker vectorLocker(sVectors[vector].load_lock);
|
||||||
bigtime_t deltaTime = system_time() - start;
|
bigtime_t deltaTime = system_time() - start;
|
||||||
sVectors[vector].last_measure_active += deltaTime;
|
sVectors[vector].last_measure_active += deltaTime;
|
||||||
locker.Unlock();
|
vectorLocker.Unlock();
|
||||||
|
|
||||||
atomic_add64(&get_cpu_struct()->interrupt_time, deltaTime);
|
cpu_ent* cpu = get_cpu_struct();
|
||||||
|
cpu->interrupt_time += deltaTime;
|
||||||
if (sVectors[vector].type == INTERRUPT_TYPE_IRQ)
|
if (sVectors[vector].type == INTERRUPT_TYPE_IRQ)
|
||||||
atomic_add64(&get_cpu_struct()->irq_time, deltaTime);
|
cpu->irq_time += deltaTime;
|
||||||
|
|
||||||
update_int_load(vector);
|
update_int_load(vector);
|
||||||
|
|
||||||
if (levelTriggered)
|
if (levelTriggered)
|
||||||
|
|||||||
@@ -393,8 +393,7 @@ reschedule(int32 nextState)
|
|||||||
ThreadData* oldThreadData = oldThread->scheduler_data;
|
ThreadData* oldThreadData = oldThread->scheduler_data;
|
||||||
|
|
||||||
// return time spent in interrupts
|
// return time spent in interrupts
|
||||||
oldThreadData->IncreaseStolenTime(
|
oldThreadData->SetStolenInterruptTime(gCPU[thisCPU].interrupt_time);
|
||||||
gCPU[thisCPU].interrupt_time - oldThreadData->LastInterruptTime());
|
|
||||||
|
|
||||||
bool enqueueOldThread = false;
|
bool enqueueOldThread = false;
|
||||||
bool putOldThreadAtBack = false;
|
bool putOldThreadAtBack = false;
|
||||||
|
|||||||
@@ -166,13 +166,6 @@ ThreadData::ComputeLoad()
|
|||||||
SCHEDULER_ENTER_FUNCTION();
|
SCHEDULER_ENTER_FUNCTION();
|
||||||
|
|
||||||
ASSERT(gTrackLoad);
|
ASSERT(gTrackLoad);
|
||||||
|
|
||||||
if (fLastInterruptTime > 0) {
|
|
||||||
bigtime_t interruptTime = gCPU[smp_get_current_cpu()].interrupt_time;
|
|
||||||
interruptTime -= fLastInterruptTime;
|
|
||||||
fMeasureActiveTime -= interruptTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
compute_load(fMeasureTime, fMeasureActiveTime, fLoad);
|
compute_load(fMeasureTime, fMeasureActiveTime, fLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,12 +51,9 @@ public:
|
|||||||
bool ChooseCoreAndCPU(CoreEntry*& targetCore,
|
bool ChooseCoreAndCPU(CoreEntry*& targetCore,
|
||||||
CPUEntry*& targetCPU);
|
CPUEntry*& targetCPU);
|
||||||
|
|
||||||
inline bigtime_t LastInterruptTime() const
|
|
||||||
{ return fLastInterruptTime; }
|
|
||||||
inline void SetLastInterruptTime(bigtime_t interruptTime)
|
inline void SetLastInterruptTime(bigtime_t interruptTime)
|
||||||
{ fLastInterruptTime = interruptTime; }
|
{ fLastInterruptTime = interruptTime; }
|
||||||
|
inline void SetStolenInterruptTime(bigtime_t interruptTime);
|
||||||
inline void IncreaseStolenTime(bigtime_t stolenTime);
|
|
||||||
|
|
||||||
inline void GoesAway();
|
inline void GoesAway();
|
||||||
inline bigtime_t WentSleep() const { return fWentSleep; }
|
inline bigtime_t WentSleep() const { return fWentSleep; }
|
||||||
@@ -226,10 +223,13 @@ ThreadData::ShouldCancelPenalty() const
|
|||||||
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
ThreadData::IncreaseStolenTime(bigtime_t stolenTime)
|
ThreadData::SetStolenInterruptTime(bigtime_t interruptTime)
|
||||||
{
|
{
|
||||||
SCHEDULER_ENTER_FUNCTION();
|
SCHEDULER_ENTER_FUNCTION();
|
||||||
fStolenTime += stolenTime;
|
|
||||||
|
interruptTime -= fLastInterruptTime;
|
||||||
|
fStolenTime += interruptTime;
|
||||||
|
fMeasureActiveTime -= interruptTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user