scheduler: Update estimate_max_scheduling_latency()
This commit is contained in:
parent
7d7dc357bf
commit
9caf7f4fb9
@ -27,6 +27,7 @@
|
|||||||
#include <scheduler_defs.h>
|
#include <scheduler_defs.h>
|
||||||
#include <smp.h>
|
#include <smp.h>
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
|
#include <util/Random.h>
|
||||||
|
|
||||||
#include <cpufreq.h>
|
#include <cpufreq.h>
|
||||||
|
|
||||||
@ -1768,18 +1769,20 @@ _user_estimate_max_scheduling_latency(thread_id id)
|
|||||||
}
|
}
|
||||||
BReference<Thread> threadReference(thread, true);
|
BReference<Thread> threadReference(thread, true);
|
||||||
|
|
||||||
// TODO: This is probably meant to be called periodically to return the
|
int32 core = thread->scheduler_data->previous_core;
|
||||||
// current estimate depending on the system usage; we return fixed estimates
|
if (core == -1)
|
||||||
// per thread priority, though.
|
core = get_random<int32>() % gCoreCount;
|
||||||
|
|
||||||
if (thread->priority >= B_REAL_TIME_DISPLAY_PRIORITY)
|
int32 threadCount = gCoreEntries[core].fThreadCount;
|
||||||
return kMinThreadQuantum / 4;
|
if (gCoreEntries[core].fCPUCount > 0)
|
||||||
if (thread->priority >= B_DISPLAY_PRIORITY)
|
threadCount /= gCoreEntries[core].fCPUCount;
|
||||||
return kMinThreadQuantum;
|
|
||||||
if (thread->priority < B_NORMAL_PRIORITY)
|
|
||||||
return 2 * kMaxThreadQuantum;
|
|
||||||
|
|
||||||
return 2 * kMinThreadQuantum;
|
if (get_effective_priority(thread) > 0) {
|
||||||
|
threadCount -= threadCount * THREAD_MAX_SET_PRIORITY
|
||||||
|
/ get_effective_priority(thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
return max_c(threadCount * kThreadQuantum, kThreadQuantum / 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@ namespace Scheduler {
|
|||||||
|
|
||||||
|
|
||||||
const bigtime_t kThreadQuantum = 1000;
|
const bigtime_t kThreadQuantum = 1000;
|
||||||
const bigtime_t kMinThreadQuantum = 3000;
|
|
||||||
const bigtime_t kMaxThreadQuantum = 10000;
|
|
||||||
|
|
||||||
const bigtime_t kCacheExpire = 100000;
|
const bigtime_t kCacheExpire = 100000;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user