@@ -214,6 +214,9 @@ type Config struct {
214214 // to limit the resources (e.g., L3 cache, memory bandwidth) the container has available
215215 IntelRdt * IntelRdt `json:"intel_rdt,omitempty"`
216216
217+ // MemoryPolicy specifies NUMA memory policy for the container.
218+ MemoryPolicy * LinuxMemoryPolicy `json:"memory_policy,omitempty"`
219+
217220 // RootlessEUID is set when the runc was launched with non-zero EUID.
218221 // Note that RootlessEUID is set to false when launched with EUID=0 in userns.
219222 // When RootlessEUID is set, runc creates a new userns for the container.
@@ -305,7 +308,8 @@ type CPUAffinity struct {
305308 Initial , Final * unix.CPUSet
306309}
307310
308- func toCPUSet (str string ) (* unix.CPUSet , error ) {
311+ // ToCPUSet parses a string in list format into a unix.CPUSet, e.g. "0-3,5,7-9".
312+ func ToCPUSet (str string ) (* unix.CPUSet , error ) {
309313 if str == "" {
310314 return nil , nil
311315 }
@@ -356,7 +360,7 @@ func toCPUSet(str string) (*unix.CPUSet, error) {
356360 }
357361 }
358362 if s .Count () == 0 {
359- return nil , fmt .Errorf ("no CPUs found in %q" , str )
363+ return nil , fmt .Errorf ("no members found in set %q" , str )
360364 }
361365
362366 return s , nil
@@ -367,11 +371,11 @@ func ConvertCPUAffinity(sa *specs.CPUAffinity) (*CPUAffinity, error) {
367371 if sa == nil {
368372 return nil , nil
369373 }
370- initial , err := toCPUSet (sa .Initial )
374+ initial , err := ToCPUSet (sa .Initial )
371375 if err != nil {
372376 return nil , fmt .Errorf ("bad CPUAffinity.Initial: %w" , err )
373377 }
374- final , err := toCPUSet (sa .Final )
378+ final , err := ToCPUSet (sa .Final )
375379 if err != nil {
376380 return nil , fmt .Errorf ("bad CPUAffinity.Final: %w" , err )
377381 }
0 commit comments