History log of /haiku/src/system/kernel/scheduler/scheduler_thread.cpp
Revision Date Author Comments
# 453027c1 21-Sep-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/scheduler: Add missing initializations to ThreadData::_InitBase().

fQuantumStart and fLastInterruptTime were not set to 0 here, so they
would default to the "malloc-cleared" data and then always overflow
the first time the interrupt time was tracked. I can't find any
reason that was supposed to be the behavior, so just set them to 0.

Also reorder the field initializations to be the same as the class
definition, which should allow some store merging optimizations.

Spotted by KUBSAN.


# 3084a700 05-Jan-2018 Michael Lotz <mmlr@mlotz.ch>

Cleanup: Remove one trailing whitespace.


# 1da76fd4 05-Feb-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Inherit estimated load, do not inherit assigned core

The initial core assignment has to be done without any knowledge about
the thread behaviour. Moreover, short lived tasks may spent most of their
time executing on that initial core. This patch attempts to improve the
qualiti of that initial decision.


# 771ae065 03-Feb-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Update priority penalty computation in debug dump


# f116370e 30-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Relax penalty cancellation requirements

Priority penalties were made more strict in order to prevent situation
when two or more high priority threads uses up all available CPU time
in such manner that they do not receive a penalty but starve low priority
threads.

However, a significant change to thread priorites has been made since and
now priority of all non real time threads varies in a range from 1 to
static priority minus penalty. This means that the scheduler is able to
prevent thread starvation without any complex penalty policies.


# 6155ab7b 30-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Provide more stable core load statistics

Originially, core load was a sum of eastimated loads of all currently
running or ready threads on a given core. Such value is changing very
rapidly preventing the thread migration logic from making any reasonable
decisions.

This patch changes the way core load is computed to make it more stable
thus improving the qualitiy of decisions made by the thread migration logic.
Currently core load is a sum of estimated loads of all threads that have been
ready during last load measurement interval and haven't been migrated or
killed.


# 931ce674 26-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix core unassignment


# 3dce49af 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Cache quantum length


# 0d27a57c 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix divide by zero on CPU disable


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

scheudler: Cache ThreadData::IsCPUBound() result


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

scheduler: Add ThreadData::{GetPriority, IsIdle, IsRealTime}()


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

scheduler: Improve latencies


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

scheduler: Increase thread penalty at fork


# 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


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

scheduler: Keep track of the number of the ready threads


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

scheduler: Improve recognition of CPU bound threads


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

kernel: Relax cpu_ent::interrupt_time locking

The value isn't accessed by the other CPUs and all writes and reads are
done with interrupts disabled.


# 8235bbc9 05-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve thread creation performance


# cb66faef 04-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Work around GCC2 limitations in function inlining

GCC2 won't inline a function if it is used before its definition.


# e4ea6372 03-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Disable load tracking when not needed


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

scheduler: Thread can not stay on CPU if it has been disabled


# 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.


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

scheduler: No need for gQuantumLengths to be global


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

scheduler: Use precomputed time slice lengths


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

scheduler: Keep thread effective priority cached


# 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


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

scheduler: Try to keep thread on the same logical CPU

Some SMT implementations (e.g. recent AMD microarchitectures) have
separate L1d cache for each SMT thread (which AMD decides to call "cores").
This means that we shouldn't move threads to another logical processor too
often even if it belongs to the same core. We aren't very strict about
this as it would complicate load balancing, but we try to reduce unnecessary
migrations.


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

scheduler: Code refactoring


# 1da76fd4cc60e12877a69ec685b00ff49bd7b34e 05-Feb-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Inherit estimated load, do not inherit assigned core

The initial core assignment has to be done without any knowledge about
the thread behaviour. Moreover, short lived tasks may spent most of their
time executing on that initial core. This patch attempts to improve the
qualiti of that initial decision.


# 771ae065dbd8326c5c464c0dc94c742b07e84a18 03-Feb-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Update priority penalty computation in debug dump


# f116370edda18472a248387a7256e2b4e528c666 30-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Relax penalty cancellation requirements

Priority penalties were made more strict in order to prevent situation
when two or more high priority threads uses up all available CPU time
in such manner that they do not receive a penalty but starve low priority
threads.

However, a significant change to thread priorites has been made since and
now priority of all non real time threads varies in a range from 1 to
static priority minus penalty. This means that the scheduler is able to
prevent thread starvation without any complex penalty policies.


# 6155ab7b25c5f0b32bb014bab5916f4594dbb685 30-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Provide more stable core load statistics

Originially, core load was a sum of eastimated loads of all currently
running or ready threads on a given core. Such value is changing very
rapidly preventing the thread migration logic from making any reasonable
decisions.

This patch changes the way core load is computed to make it more stable
thus improving the qualitiy of decisions made by the thread migration logic.
Currently core load is a sum of estimated loads of all threads that have been
ready during last load measurement interval and haven't been migrated or
killed.


# 931ce674a9dfdc8f4a05bdb54fc21b207018f7a2 26-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix core unassignment


# 3dce49af0ecc67f243fdd37fbcfa3321f7d2047b 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Cache quantum length


# 0d27a57cf17e7e60a8fbb095500e00d8c951fc80 16-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Fix divide by zero on CPU disable


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

scheudler: Cache ThreadData::IsCPUBound() result


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

scheduler: Add ThreadData::{GetPriority, IsIdle, IsRealTime}()


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

scheduler: Improve latencies


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

scheduler: Increase thread penalty at fork


# 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


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

scheduler: Keep track of the number of the ready threads


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

scheduler: Improve recognition of CPU bound threads


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

kernel: Relax cpu_ent::interrupt_time locking

The value isn't accessed by the other CPUs and all writes and reads are
done with interrupts disabled.


# 8235bbc9965b083b294b366ea5438d2ff274dbf7 05-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Improve thread creation performance


# cb66faef24f64af40a51f23300ff546d975535b3 04-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Work around GCC2 limitations in function inlining

GCC2 won't inline a function if it is used before its definition.


# e4ea637227d7cf9a53bc89317990b8a22a76780a 03-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

scheduler: Disable load tracking when not needed


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

scheduler: Thread can not stay on CPU if it has been disabled


# 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.


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

scheduler: No need for gQuantumLengths to be global


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

scheduler: Use precomputed time slice lengths


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

scheduler: Keep thread effective priority cached


# 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


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

scheduler: Try to keep thread on the same logical CPU

Some SMT implementations (e.g. recent AMD microarchitectures) have
separate L1d cache for each SMT thread (which AMD decides to call "cores").
This means that we shouldn't move threads to another logical processor too
often even if it belongs to the same core. We aren't very strict about
this as it would complicate load balancing, but we try to reduce unnecessary
migrations.


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

scheduler: Code refactoring