@@ -445,46 +445,6 @@ func cleanString(s string) string {
445445 return strings .Trim (s , "\n " )
446446}
447447
448- func cpusetCopyFromParent (path string , cgroupv2 bool ) error {
449- for _ , file := range []string {"cpuset.cpus" , "cpuset.mems" } {
450- if _ , err := cpusetCopyFileFromParent (path , file , cgroupv2 ); err != nil {
451- return err
452- }
453- }
454- return nil
455- }
456-
457- func cpusetCopyFileFromParent (dir , file string , cgroupv2 bool ) ([]byte , error ) {
458- if dir == cgroupRoot {
459- return nil , fmt .Errorf ("could not find parent to initialize cpuset %s" , file )
460- }
461- path := filepath .Join (dir , file )
462- parentPath := path
463- if cgroupv2 {
464- parentPath += ".effective"
465- }
466- data , err := os .ReadFile (parentPath )
467- if err != nil {
468- // if the file doesn't exist, it is likely that the cpuset controller
469- // is not enabled in the kernel.
470- if os .IsNotExist (err ) {
471- return nil , nil
472- }
473- return nil , err
474- }
475- if strings .Trim (string (data ), "\n " ) != "" {
476- return data , nil
477- }
478- data , err = cpusetCopyFileFromParent (filepath .Dir (dir ), file , cgroupv2 )
479- if err != nil {
480- return nil , err
481- }
482- if err := os .WriteFile (path , data , 0o644 ); err != nil {
483- return nil , fmt .Errorf ("write %s: %w" , path , err )
484- }
485- return data , nil
486- }
487-
488448// SystemCPUUsage returns the system usage for all the cgroups.
489449func SystemCPUUsage () (uint64 , error ) {
490450 _ , err := IsCgroup2UnifiedMode ()
0 commit comments