hugepages

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LimitsToString

func LimitsToString(lls []Limit) string

func SetSystemLimits

func SetSystemLimits(lh logr.Logger, cgPath string, limits []Limit) error

Types

type Limit

type Limit struct {
	// The value of PageSize has the format <size><unit-prefix>B (2MB, 1GB),
	// and must match the <hugepagesize> of the corresponding control file found in `hugetlb.<hugepagesize>.limit_in_bytes`.
	// The values of <unit-prefix> are intended to be parsed using base 1024("1KB" = 1024, "1MB" = 1048576, etc).
	PageSize string `json:"pageSize"`
	// limit in bytes of hugepagesize HugeTLB usage.
	Limit LimitValue `json:"limit"`
}

Limit is a Plain-Old-Data struct we carry around to do our computations; this way we can set `runtimeapi.HugepageLimit` once and avoid copies.

func LimitsFromAllocations

func LimitsFromAllocations(lh logr.Logger, machineData sysinfo.MachineData, allocs []types.Allocation) []Limit

func LimitsFromSystemPID

func LimitsFromSystemPID(lh logr.Logger, machineData sysinfo.MachineData, procRoot string, pid int) ([]Limit, error)

func LimitsFromSystemPath

func LimitsFromSystemPath(lh logr.Logger, machineData sysinfo.MachineData, cgPath string) ([]Limit, error)

func SumLimits

func SumLimits(lla, llb []Limit) []Limit

SumLimits add limits "llb" to the existing "lla". Note we expect to have <= 4 limits, so the simplest nested for should be perfectly fine.

func (Limit) Clone

func (lim Limit) Clone() Limit

func (Limit) String

func (lim Limit) String() string

type LimitValue

type LimitValue struct {
	Value uint64 `json:"value"`
	Unset bool   `json:"unset"`
}

func (LimitValue) Add

func (lv LimitValue) Add(x LimitValue) LimitValue

func (LimitValue) Clone

func (lv LimitValue) Clone() LimitValue

Directories

Path Synopsis
api/v0
* Copyright 2025 The Kubernetes Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* Copyright 2025 The Kubernetes Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL