Documentation
¶
Index ¶
- Constants
- func GetUserSchedPid() int
- func IsSMTActive() (bool, error)
- func KhugepagePid() uint32
- func LoadSkel() unsafe.Pointer
- func NotifyComplete(nr_pending uint64) error
- type BssData
- type BssMap
- type DispatchedTask
- type Rodata
- type RodataMap
- type Sched
- func (s *Sched) AssignUserSchedPid(pid int) error
- func (s *Sched) Attach() error
- func (s *Sched) BlockTilReadyForDequeue(ctx context.Context)
- func (s *Sched) Close()
- func (s *Sched) DecNrQueued(num uint64) error
- func (s *Sched) DefaultSelectCPU(t *models.QueuedTask) (error, int32)
- func (s *Sched) DequeueTask(task *models.QueuedTask)
- func (s *Sched) DetermineTimeSlice(t *models.QueuedTask) uint64
- func (s *Sched) DisableMaxTimeWatchdog()
- func (s *Sched) DispatchTask(t *DispatchedTask) error
- func (s *Sched) DrainQueuedTask() uint64
- func (s *Sched) EnableKernelMode()
- func (s *Sched) EnableSiblingCpu(lvlId, cpuId, siblingCpuId int32) error
- func (s *Sched) GetBssData() (BssData, error)
- func (s *Sched) GetNrQueued() uint64
- func (s *Sched) GetNrScheduled() uint64
- func (s *Sched) GetPoolCount() uint64
- func (s *Sched) GetRoData() (Rodata, error)
- func (s *Sched) GetUeiData() (UserExitInfo, error)
- func (s *Sched) PreemptCpu(cpuId int32) error
- func (s *Sched) ReadyForDequeue() bool
- func (s *Sched) RemovePriorityTask(pid uint32) error
- func (s *Sched) SelectCPU(t *models.QueuedTask) (error, int32)
- func (s *Sched) SelectQueuedTask() *models.QueuedTask
- func (s *Sched) SetBuiltinIdle(enabled bool)
- func (s *Sched) SetDebug(enabled bool)
- func (s *Sched) SetDefaultSlice(t uint64)
- func (s *Sched) SetEarlyProcessing(enabled bool)
- func (s *Sched) SetPlugin(p plugin.CustomScheduler)
- func (s *Sched) Start()
- func (s *Sched) Stopped() bool
- func (s *Sched) SubNrQueued() error
- func (s *Sched) UpdatePriorityTask(pid uint32, slice uint64) error
- func (s *Sched) UpdatePriorityTaskWithPrio(pid uint32, slice uint64, prio uint32) error
- type UeiMap
- type UserExitInfo
Constants ¶
const ( // PrioHighMin is the minimum (highest) priority for preemptive tasks PrioHighMin = 0 // PrioHighMax is the maximum priority for preemptive tasks (0-9 can preempt) PrioHighMax = 9 // PrioMedMin is the minimum priority for vtime-reduced tasks PrioMedMin = 10 // PrioMedMax is the maximum priority for vtime-reduced tasks PrioMedMax = 20 )
Priority level constants
const ( UEI_REASON_LEN = 128 UEI_MSG_LEN = 1024 )
const (
RL_CPU_ANY = 1 << 20
)
Variables ¶
This section is empty.
Functions ¶
func GetUserSchedPid ¶
func GetUserSchedPid() int
func IsSMTActive ¶
func KhugepagePid ¶
func KhugepagePid() uint32
KhugepagePid finds and returns the PID of the khugepaged process
func NotifyComplete ¶
Types ¶
type BssData ¶
type BssData struct {
Nr_running uint64 `json:"nr_running"` // Number of tasks currently running in the userspace scheduler
Nr_queued uint64 `json:"nr_queued"` // Number of tasks queued in the userspace scheduler
Nr_scheduled uint64 `json:"nr_scheduled"` // Number of tasks scheduled by the userspace scheduler
Nr_online_cpus uint64 `json:"nr_online_cpus"` // Number of online CPUs in the system
Usersched_last_run_at uint64 `json:"usersched_last_run_at"` // The PID of the userspace scheduler
Nr_user_dispatches uint64 `json:"nr_user_dispatches"` // Number of user-space dispatches
Nr_kernel_dispatches uint64 `json:"nr_kernel_dispatches"` // Number of kernel-space dispatches
Nr_cancel_dispatches uint64 `json:"nr_cancel_dispatches"` // Number of cancelled dispatches
Nr_bounce_dispatches uint64 `json:"nr_bounce_dispatches"` // Number of bounce dispatches
Nr_failed_dispatches uint64 `json:"nr_failed_dispatches"` // Number of failed dispatches
Nr_sched_congested uint64 `json:"nr_sched_congested"` // Number of times the scheduler was congested
}
type DispatchedTask ¶
type DispatchedTask struct {
Pid int32 // pid that uniquely identifies a task
Cpu int32 // target CPU selected by the scheduler
Flags uint64 // special dispatch flags
SliceNs uint64 // time slice assigned to the task (0 = default)
Vtime uint64 // task deadline / vruntime
CpuMaskCnt uint64 // cpumask generation counter (private)
}
Task queued for dispatching to the BPF component (see bpf_intf::dispatched_task_ctx).
func NewDispatchedTask ¶
func NewDispatchedTask(task *models.QueuedTask) *DispatchedTask
NewDispatchedTask creates a DispatchedTask from a QueuedTask.
type Rodata ¶
type Rodata struct {
DefaultSlice uint64 `json:"default_slice"`
SmtEnabled bool `json:"smt_enabled"`
Debug bool `json:"debug"`
Pad0 [54]byte `json:"-"` // __pad0[54]
SCXOpsNameLen uint64 `json:"scx_ops_name_len"`
SCXSliceDfl uint64 `json:"scx_slice_dfl"`
SCXSliceInf uint64 `json:"scx_slice_inf"`
SCXRqOnline uint64 `json:"scx_rq_online"`
SCXRqCanStopTick uint64 `json:"scx_rq_can_stop_tick"`
SCXRqBalPending uint64 `json:"scx_rq_bal_pending"`
SCXRqBalKeep uint64 `json:"scx_rq_bal_keep"`
SCXRqBypassing uint64 `json:"scx_rq_bypassing"`
SCXRqClkValid uint64 `json:"scx_rq_clk_valid"`
SCXRqInWakeup uint64 `json:"scx_rq_in_wakeup"`
SCXRqInBalance uint64 `json:"scx_rq_in_balance"`
SCXDsqFlagBuiltin uint64 `json:"scx_dsq_flag_builtin"`
SCXDsqFlagLocalOn uint64 `json:"scx_dsq_flag_local_on"`
SCXDsqInvalid uint64 `json:"scx_dsq_invalid"`
SCXDsqGlobal uint64 `json:"scx_dsq_global"`
SCXDsqLocal uint64 `json:"scx_dsq_local"`
SCXDsqLocalOn uint64 `json:"scx_dsq_local_on"`
SCXDsqLocalCpuMask uint64 `json:"scx_dsq_local_cpu_mask"`
SCXTaskQueued uint64 `json:"scx_task_queued"`
SCXTaskResetRunnableAt uint64 `json:"scx_task_reset_runnable_at"`
SCXTaskDeqdForSleep uint64 `json:"scx_task_deqd_for_sleep"`
SCXTaskStateShift uint64 `json:"scx_task_state_shift"`
SCXTaskStateBits uint64 `json:"scx_task_state_bits"`
SCXTaskStateMask uint64 `json:"scx_task_state_mask"`
SCXTaskCursor uint64 `json:"scx_task_cursor"`
SCXTaskNone uint64 `json:"scx_task_none"`
SCXTaskInit uint64 `json:"scx_task_init"`
SCXTaskReady uint64 `json:"scx_task_ready"`
SCXTaskEnabled uint64 `json:"scx_task_enabled"`
SCXTaskNrStates uint64 `json:"scx_task_nr_states"`
SCXTaskDsqOnPriq uint64 `json:"scx_task_dsq_on_priq"`
SCXKickIdle uint64 `json:"scx_kick_idle"`
SCXKickPreempt uint64 `json:"scx_kick_preempt"`
SCXKickWait uint64 `json:"scx_kick_wait"`
SCXEnqWakeup uint64 `json:"scx_enq_wakeup"`
SCXEnqHead uint64 `json:"scx_enq_head"`
SCXEnqPreempt uint64 `json:"scx_enq_preempt"`
SCXEnqReenq uint64 `json:"scx_enq_reenq"`
SCXEnqLast uint64 `json:"scx_enq_last"`
SCXEnqClearOpss uint64 `json:"scx_enq_clear_opss"`
SCXEnqDsqPriq uint64 `json:"scx_enq_dsq_priq"`
UeiDumpLen uint32 `json:"uei_dump_len"`
UserschedPid uint32 `json:"usersched_pid"`
KhugepagePid uint32 `json:"khugepage_pid"`
SwitchPartial bool `json:"switch_partial"`
EarlyProcessing bool `json:"early_processing"`
BuiltinIdle bool `json:"builtin_idle"`
}
type Sched ¶
type Sched struct {
// contains filtered or unexported fields
}
func (*Sched) AssignUserSchedPid ¶
func (*Sched) BlockTilReadyForDequeue ¶
func (*Sched) DecNrQueued ¶ added in v0.4.2
func (*Sched) DefaultSelectCPU ¶
func (s *Sched) DefaultSelectCPU(t *models.QueuedTask) (error, int32)
func (*Sched) DequeueTask ¶
func (s *Sched) DequeueTask(task *models.QueuedTask)
func (*Sched) DetermineTimeSlice ¶
func (s *Sched) DetermineTimeSlice(t *models.QueuedTask) uint64
func (*Sched) DisableMaxTimeWatchdog ¶ added in v0.4.3
func (s *Sched) DisableMaxTimeWatchdog()
func (*Sched) DispatchTask ¶
func (s *Sched) DispatchTask(t *DispatchedTask) error
func (*Sched) DrainQueuedTask ¶
func (*Sched) EnableKernelMode ¶ added in v0.4.2
func (s *Sched) EnableKernelMode()
func (*Sched) EnableSiblingCpu ¶
func (*Sched) GetBssData ¶
func (*Sched) GetNrQueued ¶ added in v0.4.3
func (*Sched) GetNrScheduled ¶ added in v0.4.3
func (*Sched) GetPoolCount ¶
func (*Sched) GetUeiData ¶
func (s *Sched) GetUeiData() (UserExitInfo, error)
func (*Sched) PreemptCpu ¶
func (*Sched) ReadyForDequeue ¶
func (*Sched) RemovePriorityTask ¶ added in v0.4.2
RemovePriorityTask removes a task from the priority_tasks BPF map. After removal, the task will no longer be treated as a priority task. pid: the process ID of the task to remove
func (*Sched) SelectQueuedTask ¶
func (s *Sched) SelectQueuedTask() *models.QueuedTask
func (*Sched) SetBuiltinIdle ¶
func (*Sched) SetDefaultSlice ¶
func (*Sched) SetEarlyProcessing ¶
func (*Sched) SetPlugin ¶
func (s *Sched) SetPlugin(p plugin.CustomScheduler)
func (*Sched) SubNrQueued ¶
func (*Sched) UpdatePriorityTask ¶ added in v0.4.2
UpdatePriorityTask adds or updates a task in the priority_tasks BPF map. When a task is in this map, it will be prioritized during scheduling. This function uses the default highest priority (0). pid: the process ID of the task slice: the time slice to assign to this priority task (in nanoseconds)
func (*Sched) UpdatePriorityTaskWithPrio ¶ added in v0.5.0
UpdatePriorityTaskWithPrio adds or updates a task in the priority_tasks BPF map with a specific priority level.
Priority levels:
- 0-9: High priority - can preempt tasks with lower priority (higher number)
- 10-20: Medium priority - gets vtime reduction but no preemption. Priority 10 gets 50% vtime reduction, priority 20 gets 5% reduction.
pid: the process ID of the task slice: the time slice to assign to this priority task (in nanoseconds) prio: priority level (0-20), where lower is higher priority
type UserExitInfo ¶
type UserExitInfo struct {
Kind int32
Paid uint32
ExitCode int64
Reason [UEI_REASON_LEN]C.char
Message [UEI_MSG_LEN]C.char
}
func (*UserExitInfo) GetMessage ¶
func (uei *UserExitInfo) GetMessage() string
func (*UserExitInfo) GetReason ¶
func (uei *UserExitInfo) GetReason() string