Skip to main content

Module host

Module host 

Source
Expand description

What the host’s memory leaves runners beside its other programs (ADR 0055): the slice’s runners may hold what they hold now without page cache plus the host’s MemAvailable, less a margin kept for the host’s page cache, so reclaim stays cheap; and nothing starts while the host, short of memory, stalls for it. Each bound has hysteresis, so a host at the edge does not start and hold runners by turns. Pure: the engine passes in the reading and what it remembers of the last plan.

Structs§

Remembered
What admission remembers of the host from the last plan.

Constants§

STALL_ENTER
Starts stop once every runnable task of the host waits for memory this share of the last 10 s, in hundredths of a percent: 5%, while the host is short of memory (stalls).
STALL_LEAVE
Once stopped, starts resume when that share falls under this: 1%.

Functions§

budget
What memory leaves runners beside the reserved memory of what runs in the slice, given what the last plan remembered.
left
What a host limit leaves new runners beside the reserved memory of what runs in the slice: negative by what they reserve past it, none while the host is stalled. A runner that stops gives its reservation back to this, so a deficit stays owed rather than hidden by HostBudget::spare, which stops at 0.
limit
What memory lets the slice’s runners hold in all: what the slice holds now without page cache plus MemAvailable, less the margin, larger while the host is short.
margin
The margin MemAvailable keeps beside the runners’ predicted peaks for a host with total memory: the larger of MARGIN_MIN and total / MARGIN_SHARE, half again as much while the host is short.
stalls
Whether memory’s stall shares say the host stalls for memory, given whether it did at the last plan. A stall counts only while MemAvailable is under twice the margin: the shares are the whole host’s, and a runner reclaiming at its own cap raises them with memory to spare, which starts elsewhere do not make worse.