scheduler: Fix power saving mode and other minor improvements
This commit is contained in:
parent
f95b6fdfc8
commit
13a89839fc
@ -685,7 +685,7 @@ void assign_io_interrupt_to_cpu(long vector, int32 newCPU)
|
||||
|
||||
if (newCPU == -1)
|
||||
newCPU = assign_cpu();
|
||||
dprintf_no_syslog("IRQ %ld CPU %" B_PRId32 " -> CPU %" B_PRId32 "\n", vector, oldCPU, newCPU);
|
||||
|
||||
if (newCPU == oldCPU)
|
||||
return;
|
||||
|
||||
|
@ -19,6 +19,12 @@ switch_to_mode(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_cpu_enabled(int32 /* cpu */, bool /* enabled */)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
has_cache_expired(Thread* thread)
|
||||
{
|
||||
@ -180,6 +186,7 @@ scheduler_mode_operations gSchedulerLowLatencyMode = {
|
||||
true,
|
||||
|
||||
switch_to_mode,
|
||||
set_cpu_enabled,
|
||||
has_cache_expired,
|
||||
choose_core,
|
||||
should_rebalance,
|
||||
|
@ -16,6 +16,21 @@ using namespace Scheduler;
|
||||
static int32 sSmallTaskCore;
|
||||
|
||||
|
||||
static void
|
||||
switch_to_mode(void)
|
||||
{
|
||||
sSmallTaskCore = -1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_cpu_enabled(int32 cpu, bool enabled)
|
||||
{
|
||||
if (!enabled)
|
||||
sSmallTaskCore = -1;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
has_cache_expired(Thread* thread)
|
||||
{
|
||||
@ -31,13 +46,6 @@ has_cache_expired(Thread* thread)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
switch_to_mode(void)
|
||||
{
|
||||
sSmallTaskCore = -1;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
try_small_task_packing(Thread* thread)
|
||||
{
|
||||
@ -244,6 +252,7 @@ scheduler_mode_operations gSchedulerPowerSavingMode = {
|
||||
false,
|
||||
|
||||
switch_to_mode,
|
||||
set_cpu_enabled,
|
||||
has_cache_expired,
|
||||
choose_core,
|
||||
should_rebalance,
|
||||
|
@ -583,9 +583,6 @@ should_rebalance(Thread* thread)
|
||||
{
|
||||
ASSERT(!gSingleCore);
|
||||
|
||||
if (thread_is_idle_thread(thread))
|
||||
return false;
|
||||
|
||||
return sCurrentMode->should_rebalance(thread);
|
||||
}
|
||||
|
||||
@ -600,9 +597,6 @@ compute_cpu_load(int32 cpu)
|
||||
if (oldLoad < 0)
|
||||
return;
|
||||
|
||||
if (gCPUEntries[cpu].fLoad > kVeryHighLoad)
|
||||
sCurrentMode->rebalance_irqs(false);
|
||||
|
||||
if (oldLoad != gCPUEntries[cpu].fLoad) {
|
||||
int32 core = gCPUToCore[cpu];
|
||||
|
||||
@ -611,6 +605,9 @@ compute_cpu_load(int32 cpu)
|
||||
|
||||
update_load_heaps(core);
|
||||
}
|
||||
|
||||
if (gCPUEntries[cpu].fLoad > kVeryHighLoad)
|
||||
sCurrentMode->rebalance_irqs(false);
|
||||
}
|
||||
|
||||
|
||||
@ -1069,8 +1066,7 @@ static inline void
|
||||
update_cpu_performance(Thread* thread, int32 thisCore)
|
||||
{
|
||||
int32 load = max_c(thread->scheduler_data->load,
|
||||
gCoreEntries[thisCore].fLoad);
|
||||
load /= gCoreEntries[thisCore].fCPUCount;
|
||||
get_core_load(&gCoreEntries[thisCore]));
|
||||
load = min_c(max_c(load, 0), kMaxLoad);
|
||||
|
||||
if (load < kTargetLoad) {
|
||||
@ -1369,6 +1365,8 @@ scheduler_set_cpu_enabled(int32 cpu, bool enabled)
|
||||
|
||||
gCPU[cpu].disabled = !enabled;
|
||||
|
||||
sCurrentMode->set_cpu_enabled(cpu, enabled);
|
||||
|
||||
CoreEntry* core = &gCoreEntries[gCPUToCore[cpu]];
|
||||
PackageEntry* package = &gPackageEntries[gCPUToPackage[cpu]];
|
||||
|
||||
|
@ -16,6 +16,7 @@ struct scheduler_mode_operations {
|
||||
bool avoid_boost;
|
||||
|
||||
void (*switch_to_mode)(void);
|
||||
void (*set_cpu_enabled)(int32 cpu, bool enabled);
|
||||
bool (*has_cache_expired)(Thread* thread);
|
||||
int32 (*choose_core)(Thread* thread);
|
||||
bool (*should_rebalance)(Thread* thread);
|
||||
|
Loading…
x
Reference in New Issue
Block a user