Age | Commit message (Collapse) | Author |
|
This change was done using astyle, with a few manual editing here and
there.
|
|
|
|
|
|
This module provides multiprocessor scalable reference counters, based
on Refcache, as described in the RadixVM paper.
|
|
|
|
|
|
|
|
Detached threads are actually joined by the reaper thread, and the
thread_join function would make sure it was only called on joinable
threads. Fix this inconsistency.
|
|
Make sure thread_join operates on joinable threads.
|
|
This change affects more files than it apparently would at first glance.
This is because circular dependencies can easily be created between the
thread, mutex, condition and spinlock modules. As a result, some of the
types of these modules are now defined in kern/types.h.
|
|
The thread_sleep function takes a spin lock as a parameter. This lock is
used as an interlock allowing either the thread waking up or the thread
being awaken to run. But when threads don't need a lock to provide that
guarantee, the interlock is only overhead. This change makes thread_sleep
assume disabling preemption is used as a synchronization mechanism when
the interlock is NULL.
|
|
|
|
|
|
Use a global checkpoint identifier as a generation counter and remove
reset interrupts.
For some reason I can't remember, using reset interrupts was thought to
be more efficient, perhaps because accessing a global variable on each
checkpoint looked expensive. But it's really not scalable, and a
read-mostly global variable can get cached locally and not incur expensive
access.
In addition, add a decent amount of documentation about the semantics
with regard to the rest of the system. Explicitely state that checkpoints
are triggered by context switches and that it's not allowed to block
inside read-side critical sections. Make periodic events attempt to trigger
checkpoints too. Add a thread-local read-side critical section nesting
counter so that it can be reliably determined whether the processor is
running a read-side critical section or not.
|
|
Move the increment outside of the run queue critical section.
|
|
|
|
|
|
|
|
There doesn't seem to be a need for round-robin scheduling, use the
simpler FIFO policy.
|
|
For now, there is no thread-local data to actually initialize, but the
interface is there to allow it. The main goal of this change is to avoid
the need of complex startup synchronization by allocating thread-local
data at thread creation time.
|
|
|
|
Adopt a POSIX-like behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
Start application processors once the kernel is completely initialized,
right before starting the scheduler. This simplifies the procedure with
regard to inter-processor pmap updates.
|
|
|
|
|
|
|
|
Add a processor bitmap per physical map to determine processors on which
a pmap is loaded, so that only those processors receive update IPIs. In
addition, implement lazy TLB invalidation by not loading page tables
when switching to a kernel thread. To finish with, the thread module now
calls pmap_load unconditionally without making assumptions about pmap
optimizations.
|
|
Move scheduling interrupt functions from the tcb module to the cpu module.
In addition, rename the related trap and functions to avoid mentioning
"rescheduling", as it just makes descriptions more confusing. Instead,
include the name of the module that makes use of this interrupt.
|
|
|
|
Make passing attributes and passing a thread name mandatory.
|
|
Rename THREAD_RESCHEDULE to THREAD_YIELD and thread_reschedule to
thread_yield for better clarity, and add the thread_schedule inline
function that checks for the THREAD_YIELD flag before calling
thread_yield (yielding only checks if preemption is enabled).
|
|
Refer to scheduling class data instead of context.
|
|
|
|
Processor affinity can be set before a thread is created, but currently not
changed afterwards.
|
|
|
|
This change increases clarity.
|
|
Not a necessary change, but done for consistency.
|
|
The correct type for run queue or processor identifiers is unsigned int.
The signed variant was used because of the bitmap interface, but there will
never be enough processors to trigger a problem with it, while using signed
integers can quickly mess things up.
|
|
Balancer threads use their own version of thread_sleep because they have to
keep the run queue locked after pulling threads, otherwise remote balancers
might pull threads from a run queue right before a scheduling decision is
made, possibly putting the run queue in a state where only expired threads
remain.
Although this might be relaxed in the future, this is how it's currently
done, and a clear note in the main balancer function definitely helps against
breaking that part.
|
|
Not required nor used, but done for consistency.
|
|
This module provides lockless synchronization so that reads can safely occur
during updates, without holding a lock. It is based on passive serialization
as described in US patent 4809168, and achieves a goal similar to Linux RCU
(Read-Copy Update).
|
|
The upcoming lockless synchronization implementation requires the idle loop
to report when it's about to enter/leave the idle state. Preemption must be
disabled to accomplish that.
|
|
|
|
|
|
|