* Added cpu_ent::running_thread which is maintained by the schedulers.

* simple_smp scheduler: Rewrote the interesting part of
  enqueue_in_run_queue(). It always selects a target CPU for the inserted
  thread, now. If no CPU is idle, the CPU running the thread with the lowest
  priority is chosen. If the thread running on the target CPU has a lower
  priority than the inserted one, it will be asked to reschedule. If that's
  the current CPU, we'll return the correct value (wasn't done before at
  all).
  These changes help reducing latencies. On my machine in an idle system
  playing music DebugAnalyzer shows maximum latencies of about 1 us. I still
  find that a bit much, but it's several orders of magnitude better than
  before. The -j8 Haiku image build time dropped about 10%.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34635 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-12-11 19:06:57 +00:00
parent edc69377fa
commit b4be7c9021
5 changed files with 81 additions and 45 deletions
+16 -12
View File
@@ -23,28 +23,32 @@
#endif
struct thread;
/* CPU local data structure */
typedef struct cpu_ent {
int cpu_num;
int cpu_num;
// thread.c: used to force a reschedule at quantum expiration time
int preempted;
timer quantum_timer;
int preempted;
timer quantum_timer;
// keeping track of CPU activity
bigtime_t active_time;
bigtime_t last_kernel_time;
bigtime_t last_user_time;
bigtime_t active_time;
bigtime_t last_kernel_time;
bigtime_t last_user_time;
// used in the kernel debugger
addr_t fault_handler;
addr_t fault_handler_stack_pointer;
jmp_buf fault_jump_buffer;
addr_t fault_handler;
addr_t fault_handler_stack_pointer;
jmp_buf fault_jump_buffer;
bool invoke_scheduler;
bool invoke_scheduler_if_idle;
bool disabled;
struct thread* running_thread;
bool invoke_scheduler;
bool invoke_scheduler_if_idle;
bool disabled;
// arch-specific stuff
arch_cpu_info arch;