template <typename Op, typename TargetType>

class PiOperation

Defined at line 32 of file ../../zircon/kernel/kernel/scheduler_pi.cc

PiOperation is an inner class of Scheduler and the base class of each of the

various PI operations we need to implement. Its primary jobs are:

1) Provide accessors abstract the distinction between a thread and an owned

wait queue when working with templated methods who operate on an UpstreamType

and a TargetType, where each type might be either a Thread or an

OwnedWaitQueue.

2) Implement the common PI handler responsible for obtaining the proper

locks, and removing/re-inserting a target from/to its container while

updating the targets dynamic scheduling parameters.

3) Do all of this using CRTP instead of lambdas, allowing us to preserve

our static annotations all of the way through the operation instead of

needing to dynamically assert that we hold certain capabilities throughout

the operation.

Protected Members

TargetType & target_

Protected Methods

void PiOperation<Op, TargetType> (TargetType & target)

Defined at line 34 of file ../../zircon/kernel/kernel/scheduler_pi.cc

void AssertEpDirtyState (const Thread & thread, SchedulerState::ProfileDirtyFlag expected)

Defined at line 36 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime & GetStartTime (Thread & thread)

Defined at line 41 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime & GetFinishTime (Thread & thread)

Defined at line 45 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration & GetTimeSliceNs (Thread & thread)

Defined at line 49 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration & GetTimeSliceUsedNs (Thread & thread)

Defined at line 53 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime GetStartTime (const Thread & thread)

Defined at line 57 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime GetFinishTime (const Thread & thread)

Defined at line 61 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration GetTimeSliceNs (const Thread & thread)

Defined at line 65 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration GetTimeSliceUsedNs (const Thread & thread)

Defined at line 69 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration GetRemainingTimeSliceNs (const Thread & thread)

Defined at line 73 of file ../../zircon/kernel/kernel/scheduler_pi.cc

void AssertEpDirtyState (const OwnedWaitQueue & owq, SchedulerState::ProfileDirtyFlag expected)

OwnedWaitQueues do not need to bother to track the dirty or clean state of

their implied effective profile. They have no base profile (only inherited

values) which gets turned into an effective profile by the

EffectiveProfileHeper (see below) during a PI interaction. We can get away

with this because OWQs:

1) Cannot exist in any collections where their position is determined by effective profile

(otherwise we would need to remove and re-insert the node in the collection during an

update).

2) Cannot contribute to a scheduler's bookkeeping (because OWQs are not things which get

scheduled).

Defined at line 89 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime & GetStartTime (OwnedWaitQueue & owq)

Defined at line 93 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime & GetFinishTime (OwnedWaitQueue & owq)

Defined at line 97 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration & GetTimeSliceNs (OwnedWaitQueue & owq)

Defined at line 101 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration & GetTimeSliceUsedNs (OwnedWaitQueue & owq)

Defined at line 105 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime GetStartTime (const OwnedWaitQueue & owq)

Defined at line 109 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedTime GetFinishTime (const OwnedWaitQueue & owq)

Defined at line 113 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration GetTimeSliceNs (const OwnedWaitQueue & owq)

Defined at line 117 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration GetTimeSliceUsedNs (const OwnedWaitQueue & owq)

Defined at line 121 of file ../../zircon/kernel/kernel/scheduler_pi.cc

SchedDuration GetRemainingTimeSliceNs (const OwnedWaitQueue & owq)

Defined at line 125 of file ../../zircon/kernel/kernel/scheduler_pi.cc

void HandlePiInteractionCommon ()

Handle all of the common tasks associated with each of the possible PI

interactions. The outline of this is:

1) If the target is an active thread (meaning either running or runnable),

we need to:

1.1) Enter the scheduler's queue lock.

1.2) If the thread is active, but not actually running, remove the target

thread from its scheduler's run queue if it is in the queue.

1.3) Now update the thread's effective profile.

1.4) Apply any changes in the thread's effective profile to its scheduler's

bookkeeping.

1.5) Update the dynamic parameters of the thread.

1.6) Either re-insert the thread into its scheduler's run queue (if it was

READY AND in the queue) or adjust its schedulers preemption time (if it

was RUNNING).

1.7) Trigger a reschedule of the the thread's CPU.

2) If the target is either an OwnedWaitQueue, or a thread which is not

active:

2.1) Recompute the target's effective profile, adjust the target's position

in it's wait queue if the target is a thread which is currently

blocked in a wait queue.

2.2) Recompute the target's dynamic scheduler parameters.

Defined at line 678 of file ../../zircon/kernel/kernel/scheduler_pi.cc