MCPcopy
hub / github.com/opencontainers/runc / setFinalCPUAffinity

Method setFinalCPUAffinity

libcontainer/process_linux.go:242–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

240}
241
242func (p *setnsProcess) setFinalCPUAffinity() error {
243 aff := p.config.CPUAffinity
244 // If there was no affinity configured at all, we want to reset
245 // the affinity to make sure we don't inherit an unexpected one.
246 if aff == nil || aff.Final == nil && aff.Initial == nil {
247 tryResetCPUAffinity(p.pid())
248 return nil
249 }
250 if aff.Final == nil {
251 return nil
252 }
253 if err := unix.SchedSetaffinity(p.pid(), aff.Final); err != nil {
254 return fmt.Errorf("error setting final CPU affinity: %w", err)
255 }
256 return nil
257}
258
259func (p *setnsProcess) addIntoCgroupV1() error {
260 if sub, ok := p.process.SubCgroupPaths[""]; ok || len(p.process.SubCgroupPaths) == 0 {

Callers 1

startMethod · 0.95

Calls 2

tryResetCPUAffinityFunction · 0.85
pidMethod · 0.65

Tested by

no test coverage detected