History log of /haiku/src/system/kernel/scheduler/low_latency.cpp
Revision Date Author Comments
# 91810926 08-Apr-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix and simplify thread migration logic in low latency mode

This patch remove the old thread migration logic which used few special
cases and (broken) general check that attempted to balance threads.

The new logic is pretty straightforward and seems perform well without
any additional special cases. Current core is compared with the least loaded
one and the thread is migrated if that would result in estimated loads of
both cores (i.e. the current one and the least loaded one) to become closer
to the average load (i.e. average of that two cores).


# 1bba129c 08-Apr-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Let ThreadData::ShouldRebalance() choose the actual core

Currently, ThreadData::ShouldRebalance() (and mode specific functions
it calls) only decides whether to migrate thread to another core or not.
However, in most cases it actually needs to find the best candidate for
new core so it could as well return that information.


# 0012ba6a 09-Mar-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler/low_latency: Try harder to balance load

In low latency mode the scheduler would not attempt to balance load
on not heavily loaded cores unless difference in load exceeded
kLoadDifference * 2 (i.e. 40 percentage points), which does not seem
to be good enough.


# 1700e825 05-Mar-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Always protect gCore[High]LoadHeap with spinlock

Should fix #10628. If there is a race condition with a writer getting
minimum or maximum from double ended heap may incorrectly result NULL.
Which is not expected in the most of the thread migration logic. Apart
from that, because of the race condition heap state may be observed as
inconsistent thus failing assertions.
ended heap


# 4835c216 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: low_latency: Try to keep all cores busy


# 093c2202 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve latencies


# a2634874 08-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Estimate the load thread is able to produce

Previous implementation based on the actual load of each core and share
each thread has in that load turned up to be very problematic when
balancing load on very heavily loaded systems (i.e. more threads
consuming all available CPU time than there is logical CPUs).

The new approach is to estimate how much load would a thread produce
if it had all CPU time only for itself. Summing such load estimations
of each thread assigned to a given core we get a rank that contains
much more information than just simple actual core load.


# 772331c7 07-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Introduce strong and weak priority penalties


# 9c465cc8 07-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve recognition of CPU bound threads


# c37c2aa4 06-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve should_rebalance


# 2d52abbd 30-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Inherit penalty and core from creator thread


# ef8e55a1 28-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Use single ended heap for CPU heap


# 96dcc73b 26-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Add scheduler profiler

A bit hackish implementation of a profiler for the scheduler.
SCHEDULER_ENTER_FUNCTION at the begining of each function aren't nice and
usage of __PRETTY_FUNCTION__ isn't any better (both gcc and clang support
it though), but it was quick to implement and doesn't lose information
on inlined functions. It's just a tool, not an integral part of the kernal
anyway.


# b24ea642 23-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate ThreadData fields


# a08b40d4 23-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate CPUEntry fields


# e1e7235c 23-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate CoreEntry fields


# 60e198f2 22-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate PackageEntry fields

Apart from the refactoring this commit takes the opportunity and removes
unnecessary read locks when choosing a package and a core from idle lists.
The data structures are accessed in a thread safe way and it does not really
matter whether the obtained data becomes outdated just when we release the
lock or during our search for the appropriate package/core.


# ad6b9a1d 19-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Use sequential locks instead of atomic 64 bit access


# d287274d 05-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Code refactoring


# 07218997 28-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Allow mode to specify time slice length


# f9ee217a 28-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Migrate threads less often in power saving mode


# 87115715 26-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Protect package data with rw_spinlock


# 13a89839 24-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix power saving mode and other minor improvements


# 1a7eb502 21-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Calculate correct load on SMT processors


# 65741c8b 21-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve locking


# 6fb61d00 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Preallocate temporary heaps for debug commands


# c4ac37a3 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Try to pack IRQs in power saving mode


# 9c2e74da 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Move mode specific logic to separate files


# 91810926dc2c3ed970d5dc3b304a841e63835d0c 08-Apr-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix and simplify thread migration logic in low latency mode

This patch remove the old thread migration logic which used few special
cases and (broken) general check that attempted to balance threads.

The new logic is pretty straightforward and seems perform well without
any additional special cases. Current core is compared with the least loaded
one and the thread is migrated if that would result in estimated loads of
both cores (i.e. the current one and the least loaded one) to become closer
to the average load (i.e. average of that two cores).


# 1bba129c56656a5c140fc8d1202ae1cac761d49b 08-Apr-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Let ThreadData::ShouldRebalance() choose the actual core

Currently, ThreadData::ShouldRebalance() (and mode specific functions
it calls) only decides whether to migrate thread to another core or not.
However, in most cases it actually needs to find the best candidate for
new core so it could as well return that information.


# 0012ba6a87f1286164160b6d14516e4bad0f63c3 09-Mar-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler/low_latency: Try harder to balance load

In low latency mode the scheduler would not attempt to balance load
on not heavily loaded cores unless difference in load exceeded
kLoadDifference * 2 (i.e. 40 percentage points), which does not seem
to be good enough.


# 1700e825b1249917f478aca067bf7b84c3642fa3 05-Mar-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Always protect gCore[High]LoadHeap with spinlock

Should fix #10628. If there is a race condition with a writer getting
minimum or maximum from double ended heap may incorrectly result NULL.
Which is not expected in the most of the thread migration logic. Apart
from that, because of the race condition heap state may be observed as
inconsistent thus failing assertions.
ended heap


# 4835c216f783497c2a8e1bc8eea073925597148d 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: low_latency: Try to keep all cores busy


# 093c2202675b2ef2c9a76dec558fe6ed4a5e6f17 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve latencies


# a2634874ed5e33a36fe83c272614e2042fafde1d 08-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Estimate the load thread is able to produce

Previous implementation based on the actual load of each core and share
each thread has in that load turned up to be very problematic when
balancing load on very heavily loaded systems (i.e. more threads
consuming all available CPU time than there is logical CPUs).

The new approach is to estimate how much load would a thread produce
if it had all CPU time only for itself. Summing such load estimations
of each thread assigned to a given core we get a rank that contains
much more information than just simple actual core load.


# 772331c7cdd486b7283ea138621693df88a9327b 07-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Introduce strong and weak priority penalties


# 9c465cc83bbd40732475db43bd870221b99bdbb7 07-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve recognition of CPU bound threads


# c37c2aa45fd02af0fa4941751bdabf5cbcc664d6 06-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve should_rebalance


# 2d52abbd5d279c622982b8cae1f38d51bf73c2d2 30-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Inherit penalty and core from creator thread


# ef8e55a1d09185c714afac7b5d00f28064af3428 28-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Use single ended heap for CPU heap


# 96dcc73b39cc68a59c276a35690f8af1886214ef 26-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Add scheduler profiler

A bit hackish implementation of a profiler for the scheduler.
SCHEDULER_ENTER_FUNCTION at the begining of each function aren't nice and
usage of __PRETTY_FUNCTION__ isn't any better (both gcc and clang support
it though), but it was quick to implement and doesn't lose information
on inlined functions. It's just a tool, not an integral part of the kernal
anyway.


# b24ea642d759ad6e6b30007cb112b3cdfad35204 23-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate ThreadData fields


# a08b40d4087b35c586959dc7da44035171d4cf15 23-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate CPUEntry fields


# e1e7235c60d942d4fd58ac7caedf4a9715efcc7a 23-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate CoreEntry fields


# 60e198f2cbf2e26b584370c0d32c37cb3dce556c 22-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Encapsulate PackageEntry fields

Apart from the refactoring this commit takes the opportunity and removes
unnecessary read locks when choosing a package and a core from idle lists.
The data structures are accessed in a thread safe way and it does not really
matter whether the obtained data becomes outdated just when we release the
lock or during our search for the appropriate package/core.


# ad6b9a1df8ccdb1093c4b122764f8692d6f7ca2c 19-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Use sequential locks instead of atomic 64 bit access


# d287274dcec634da4973a1b92c97dd14d7c5ecd0 05-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Code refactoring


# 072189970913d3cce35c34b4307b5e58b0f241b5 28-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Allow mode to specify time slice length


# f9ee217ad6c59122fefd39a445c99f2c0fb2af1e 28-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Migrate threads less often in power saving mode


# 87115715b40c394b08de08b6709863eb257b020d 26-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Protect package data with rw_spinlock


# 13a89839fc09fea7d328568ddb76d8369ce2839d 24-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix power saving mode and other minor improvements


# 1a7eb50254e1cee8160de17253aa6972c3d960cf 21-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Calculate correct load on SMT processors


# 65741c8b56b2fc74e8e1cd419b92f799e75f556d 21-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve locking


# 6fb61d001a6022e27892cc643f345541c4e954dc 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Preallocate temporary heaps for debug commands


# c4ac37a35e449a07393867fed7278f377cca8dbf 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Try to pack IRQs in power saving mode


# 9c2e74da043b32ecd64a0ec4f4917f83ac6cc10f 20-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Move mode specific logic to separate files