affinity

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package affinity decides where a backend's workers run.

It is shared rather than per-backend because the two things that decide the answer are not specific to one: the memory node the card is attached to, and the cache complex a worker's doorbell writes travel from. The measurement below was taken on mlx5 Direct Verbs and applies unchanged to any backend whose workers ring doorbells through the same write-combining pages, which includes DPDK's mlx5 poll-mode driver.

A backend names itself in any error it passes on; nothing here does, so the same message reads correctly whichever backend produced it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Placement

type Placement struct {
	// contains filtered or unexported fields
}

placement is the order in which processors are handed to workers, and the record of which ones have been handed out.

func New

func New(ifname string, want []int) (*Placement, error)

New works out where a device's workers should run. want, when not empty, is the caller's own list and is used in the order given.

It returns nil, nil when the machine's topology yields nothing usable, which means "leave the workers where the scheduler puts them" rather than an error.

func (*Placement) Pin

func (p *Placement) Pin() (int, error)

Pin puts the calling goroutine on a processor of its own and reports which.

A goroutine that drives several queues asks once per queue; the second and later calls find the thread already placed and leave it where it is, which is what makes "one worker, four queues" work without the queues fighting over where the worker runs.

func (*Placement) String

func (p *Placement) String() string

String describes what was decided, for a program that wants to print it.

Jump to

Keyboard shortcuts

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