Commit Graph

5661 Commits

Author SHA1 Message Date
Pawel Dziepak
8235bbc996 scheduler: Improve thread creation performance 2014-01-06 01:22:53 +01:00
Pawel Dziepak
cb66faef24 scheduler: Work around GCC2 limitations in function inlining
GCC2 won't inline a function if it is used before its definition.
2014-01-06 01:22:53 +01:00
Pawel Dziepak
9e99bf6085 scheduler: SCHEDULER_EXIT_FUNCTION() is not needed 2014-01-03 20:15:13 +01:00
Pawel Dziepak
81e04d7b97 kernel: Remove cpu_info::load
This field forces kernel to track each CPU load all the time. It is not
a problem with the current scheduler on a multicore systems, but on
single core machnies or with any other future scheduler this field may
become just an unnecessary burden. It isn't difficult for an application
to compute CPU load by itself when it needs it.
2014-01-03 19:44:57 +01:00
Pawel Dziepak
e4ea637227 scheduler: Disable load tracking when not needed 2014-01-03 19:44:56 +01:00
Pawel Dziepak
db1ddabfd0 scheduler: Thread can not stay on CPU if it has been disabled 2013-12-31 04:49:45 +01:00
Pawel Dziepak
2d52abbd5d scheduler: Inherit penalty and core from creator thread 2013-12-31 03:53:55 +01:00
Pawel Dziepak
7c92dffeef scheduler: Fix order of the includes
Thanks Jérôme!
2013-12-31 03:53:55 +01:00
Pawel Dziepak
265927509d scheduler: Protect per CPU run queue with its own lock 2013-12-31 03:53:55 +01:00
Pawel Dziepak
1524fbf742 scheduler: Fix divide error in _RequestPerformanceLevel 2013-12-30 06:10:14 +01:00
Pawel Dziepak
046af755d0 x86: Fix stack corruption in cache topology detection 2013-12-30 06:10:14 +01:00
Pawel Dziepak
8aa1539bb0 scheduler: Strengthen CoreEntry::GetLoad() assertion 2013-12-30 06:10:14 +01:00
Pawel Dziepak
15a7f2046a kernel: Return CPU load in cpu_info 2013-12-29 22:47:06 +01:00
Pawel Dziepak
56c0f467b0 scheduler: Fix unused variable warnings 2013-12-29 22:47:05 +01:00
Pawel Dziepak
a47974dd06 scheduler: Use heap to determine highest priority thread 2013-12-29 19:24:01 +01:00
Pawel Dziepak
484e5c737f scheduler: profiler: Compare types larger than int properly 2013-12-29 19:19:21 +01:00
Pawel Dziepak
ef8e55a1d0 scheduler: Use single ended heap for CPU heap 2013-12-28 21:47:35 +01:00
Pawel Dziepak
712f37e19e scheduler: profiler: Use nanosecond as a main time unit 2013-12-28 21:03:43 +01:00
Pawel Dziepak
ca9137de37 scheduler: Profile RunQueue implementation 2013-12-28 20:46:22 +01:00
Pawel Dziepak
4c25fcab38 scheduler: Fix double release of run queue lock 2013-12-28 20:11:30 +01:00
Pawel Dziepak
f68a486001 scheduler: Ignore time used by the profiler implementation 2013-12-28 18:55:39 +01:00
Pawel Dziepak
65d28952ae scheduler: Make sure RunQueueLink::{fPrevious, fNext} are valid 2013-12-26 22:07:26 +01:00
Pawel Dziepak
335c60552c scheduler: Remove CPUEntry::IncreaseActiveTime() 2013-12-26 19:56:50 +01:00
Pawel Dziepak
9a6868d565 x86: Fix build with kernel debugging disabled 2013-12-26 19:55:33 +01:00
Pawel Dziepak
96dcc73b39 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.
2013-12-26 19:40:50 +01:00
Pawel Dziepak
ebe5420f84 scheduler: No need for gQuantumLengths to be global 2013-12-26 19:40:50 +01:00
Pawel Dziepak
cf4984f645 scheduler: Use precomputed time slice lengths 2013-12-23 22:49:12 +01:00
Pawel Dziepak
ede552ab25 scheduler: Keep thread effective priority cached 2013-12-23 22:06:33 +01:00
Pawel Dziepak
b24ea642d7 scheduler: Encapsulate ThreadData fields 2013-12-23 21:32:21 +01:00
Pawel Dziepak
a08b40d408 scheduler: Encapsulate CPUEntry fields 2013-12-23 20:15:16 +01:00
Pawel Dziepak
e1e7235c60 scheduler: Encapsulate CoreEntry fields 2013-12-23 18:27:10 +01:00
Pawel Dziepak
5a69ffc01e scheduler: Remove RunQueue::PeekSecondMaximum() 2013-12-23 03:51:02 +01:00
Pawel Dziepak
60e198f2cb 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.
2013-12-23 00:56:44 +01:00
Pawel Dziepak
cf21c40b50 x86: Fix style
Thanks Axel.
2013-12-23 00:09:03 +01:00
Pawel Dziepak
b89b5d3826 x86: Make arch/smp.h a C++ only header 2013-12-20 22:05:26 +01:00
Pawel Dziepak
9116eec24c scheduler: Allow calling UpdatePriority() for disabled CPU 2013-12-20 05:40:59 +01:00
Pawel Dziepak
b4552fcf9b x86: Remove debug message 2013-12-20 05:40:59 +01:00
Pawel Dziepak
73363f8dde kernel/vm: Fix unsigned/signed comparison warning 2013-12-20 05:40:59 +01:00
Pawel Dziepak
c08ed2db65 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.
2013-12-20 03:36:01 +01:00
Pawel Dziepak
ad6b9a1df8 scheduler: Use sequential locks instead of atomic 64 bit access 2013-12-20 02:18:44 +01:00
Pawel Dziepak
b258298c70 kernel: Protect cpu_ent::active_time with sequential lock
atomic_{get, set}64() are problematic on architectures without 64 bit
compare and swap.
Also, using sequential lock instead of atomic access ensures that
any reads from cpu_ent::active_time won't require any writes to shared
memory.
2013-12-20 01:31:32 +01:00
Pawel Dziepak
6639514437 x86[_64]: Support assigning MSI IRQs to arbitrary CPU 2013-12-20 01:07:08 +01:00
Pawel Dziepak
3add52e8ba kernel: Fix topology node count being decreased twice per node 2013-12-19 20:24:34 +01:00
Pawel Dziepak
e3d001ff02 x86: Implement multicast ICIs 2013-12-19 19:35:44 +01:00
Pawel Dziepak
5a7289d720 scheduler: Fix unassigning threads from core being disabled 2013-12-18 00:03:56 +01:00
Pawel Dziepak
1b06228f13 kernel: Propagate scheduler modes to cpu{freq, idle} modules 2013-12-17 23:26:37 +01:00
Pawel Dziepak
4fcbac58de kernel: Make get_cpu_topology() return a pointer to const
The client code is not supposed to change the topology info.
It would be also nice if cpu_topology_node::children was an array of
pointers to const but that would require several const_casts in the
topology tree generation code so it's probably not worth it.
2013-12-17 22:08:18 +01:00
Pawel Dziepak
735f67481f x86: Debugger can now use dr3 2013-12-17 04:31:29 +01:00
Pawel Dziepak
a5b070f1fa x86: Store pointer to the current thread in gs:0
Apparently, reading from dr3 is slower than reading from memory
with cache hit.

Also, depending on hypervisor configuration, accessing dr3 may cause
a VM exit (and, at least on kvm, it does), what makes it much slower
than a memory access even when there is a cache miss.
2013-12-17 04:08:51 +01:00
Pawel Dziepak
611376fef7 x86: Let each CPU have its own GDT 2013-12-17 03:57:20 +01:00