package sched

import "gvisor.dev/gvisor/pkg/sentry/kernel/sched"

Package sched implements scheduler related features.

Index

Functions

func CPUSetSize

func CPUSetSize(num uint) uint

CPUSetSize returns the size in bytes of a CPUSet that can contain num cpus.

Types

type CPUSet

type CPUSet []byte

CPUSet contains a bitmap to record CPU information.

Note that this definition is only correct for little-endian architectures, since Linux's cpumask_t uses unsigned long.

func NewCPUSet

func NewCPUSet(num uint) CPUSet

NewCPUSet returns a CPUSet for the given number of CPUs which initially contains no CPUs.

func NewFullCPUSet

func NewFullCPUSet(num uint) CPUSet

NewFullCPUSet returns a CPUSet for the given number of CPUs, all of which are present in the set.

func (*CPUSet) ClearAbove

func (c *CPUSet) ClearAbove(cpu uint)

ClearAbove clears bits corresponding to cpu and all higher cpus.

func (CPUSet) Copy

func (c CPUSet) Copy() CPUSet

Copy returns a copy of the CPUSet.

func (CPUSet) ForEachCPU

func (c CPUSet) ForEachCPU(fn func(uint))

ForEachCPU iterates over the CPUSet and calls fn with the cpu index if it's set.

func (CPUSet) NumCPUs

func (c CPUSet) NumCPUs() uint

NumCPUs returns how many cpus are set in the CPUSet.

func (*CPUSet) Set

func (c *CPUSet) Set(cpu uint)

Set sets the bit corresponding to cpu.

func (CPUSet) Size

func (c CPUSet) Size() uint

Size returns the size of 'c' in bytes.

Source Files

cpuset.go sched.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
4 hours ago

Tools for package owners.