History log of /haiku-fatelf/src/system/kernel/scheduler/scheduler_simple_smp.cpp
Revision Date Author Comments
# 4be4fc6b 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 78af90d4 14-May-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Fix codestyle violation:
Multiline statements after if should always be in a code block.
No functional change.


# 44c3c034 13-May-2012 Yongcong Du <ycdu.vmcore@gmail.com>

scheduler: Don't setup the quantumTimer for idle thread

Let's say the timer is waken up when its hook is called. This patch
reduces ~41% wakeups during idle

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3e86abbd 18-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added an extra check as requested by CID 1567, but also added a comment why
this (and other checks) should not be necessary in the first place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38229 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee0d2be9 11-Apr-2010 Axel Dörfler <axeld@pinc-software.de>

bonefish+axeld:
* Implemented a tiny bit more sophisticated version of
estimate_max_scheduling_latency() that uses a syscall that lets the scheduler
decide.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36170 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0338371f 13-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* All scheduler implementations:
- enqueue_in_run_queue() no longer returns whether rescheduling is supposed
to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU.
- reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need
to let all callers do that.
* thread_unblock[_locked]() no longer return whether rescheduling is supposed
to happen.
* Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really
can't know, when it makes sense to reschedule or not.
* Introduced scheduler_reschedule_if_necessary[_locked]() functions for
checking+invoking the scheduler.
* Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if
they wake up anything with greater priority.
I've also tried to add scheduler invocations in the condition variable and
mutex/rw_lock code, but that actually has a negative impact on performance,
probably because it causes too much ping-ponging between threads when
multiple locking primitives are involved.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96


# adf9b14e 12-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied r34634 to the simple SMP scheduler as well (Rene was right, I just
overlooked it).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34641 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e36d79e9 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

CPU selection in enqueue_in_run_queue():
* Moved the CPU selection conde into a separate function.
* Re-added the support for disabling CPUs, which I accidentally removed.
* Got rid of idle CPU tracking. We don't need it anymore -- we iterate
through all CPUs and check the priority of the running thread.
* Added a kind of round-robin component to the CPU selection loop, so that
we pick CPUs more evenly. And indeed, the ProcessController display is
less skewed, now. There doesn't seem to be a measurable performance gain,
though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34637 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b4be7c90 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# ec1dcae8 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

We have to use dprintf_no_syslog() in the scheduler, as all code is executed
with the threads spinlock held.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34629 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3533b659 10-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reintroduced the SMP_MSG_RESCHEDULE_IF_IDLE ICI message. This time
implemented by means of an additional member in cpu_ent.
* Removed thread::keep_scheduled and the related functions. The feature
wasn't used yet and wouldn't have worked as implemented anyway.
* Resurrected an older, SMP aware version of our simple scheduler and made it
the default instead of the affine scheduler. The latter is in no state to
be used yet. It causes enormous latencies (I've seen up to 0.1s) even when
six or seven CPUs were idle at the same time, totally killing parallelism.
That's also the reason why a -j8 build was slower than a -j2. This is no
longer the case. On my machine the -j2 build takes about 10% less time now
and the -j8 build saves another 20%. The latter is not particularly
impressive (compared with Linux), but that seems to be due to lock
contention.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34615 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4be4fc6b1faddbd037146214a0011d320842b4f3 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 78af90d4946bd94e78ceaec1eefdd02e5649e515 14-May-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Fix codestyle violation:
Multiline statements after if should always be in a code block.
No functional change.


# 44c3c034122cd698fd6dc4288327e406cd4b3e1c 13-May-2012 Yongcong Du <ycdu.vmcore@gmail.com>

scheduler: Don't setup the quantumTimer for idle thread

Let's say the timer is waken up when its hook is called. This patch
reduces ~41% wakeups during idle

Signed-off-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3e86abbd71aaba972b1e9865b7e088d4b35ec3bf 18-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added an extra check as requested by CID 1567, but also added a comment why
this (and other checks) should not be necessary in the first place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38229 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee0d2be9e44bc80bd060f2ad24fbf29d8d449250 11-Apr-2010 Axel Dörfler <axeld@pinc-software.de>

bonefish+axeld:
* Implemented a tiny bit more sophisticated version of
estimate_max_scheduling_latency() that uses a syscall that lets the scheduler
decide.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36170 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0338371f26864c2a248b1ea53b9fe78c884af7f2 13-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* All scheduler implementations:
- enqueue_in_run_queue() no longer returns whether rescheduling is supposed
to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU.
- reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need
to let all callers do that.
* thread_unblock[_locked]() no longer return whether rescheduling is supposed
to happen.
* Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really
can't know, when it makes sense to reschedule or not.
* Introduced scheduler_reschedule_if_necessary[_locked]() functions for
checking+invoking the scheduler.
* Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if
they wake up anything with greater priority.
I've also tried to add scheduler invocations in the condition variable and
mutex/rw_lock code, but that actually has a negative impact on performance,
probably because it causes too much ping-ponging between threads when
multiple locking primitives are involved.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96


# adf9b14ed68588eda9061dada07f6a624ff0d10c 12-Dec-2009 Axel Dörfler <axeld@pinc-software.de>

* Applied r34634 to the simple SMP scheduler as well (Rene was right, I just
overlooked it).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34641 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e36d79e9dcb4585065af75dac751834ea6f7ee24 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

CPU selection in enqueue_in_run_queue():
* Moved the CPU selection conde into a separate function.
* Re-added the support for disabling CPUs, which I accidentally removed.
* Got rid of idle CPU tracking. We don't need it anymore -- we iterate
through all CPUs and check the priority of the running thread.
* Added a kind of round-robin component to the CPU selection loop, so that
we pick CPUs more evenly. And indeed, the ProcessController display is
less skewed, now. There doesn't seem to be a measurable performance gain,
though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34637 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b4be7c902190522214ae7532900725b8f446ef8e 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# ec1dcae8cd1a477d3d44b441c7213779639c86d0 11-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

We have to use dprintf_no_syslog() in the scheduler, as all code is executed
with the threads spinlock held.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34629 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3533b6597db4ad65493632da8a92c1f6ea3de149 10-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reintroduced the SMP_MSG_RESCHEDULE_IF_IDLE ICI message. This time
implemented by means of an additional member in cpu_ent.
* Removed thread::keep_scheduled and the related functions. The feature
wasn't used yet and wouldn't have worked as implemented anyway.
* Resurrected an older, SMP aware version of our simple scheduler and made it
the default instead of the affine scheduler. The latter is in no state to
be used yet. It causes enormous latencies (I've seen up to 0.1s) even when
six or seven CPUs were idle at the same time, totally killing parallelism.
That's also the reason why a -j8 build was slower than a -j2. This is no
longer the case. On my machine the -j2 build takes about 10% less time now
and the -j8 build saves another 20%. The latter is not particularly
impressive (compared with Linux), but that seems to be due to lock
contention.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34615 a95241bf-73f2-0310-859d-f6bbb57e9c96