Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pkg/sysinfo/numcpu_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package sysinfo

import (
"math/bits"
"unsafe"

"golang.org/x/sys/windows"
Expand All @@ -22,7 +23,5 @@ func numCPU() int {
if ret == 0 {
return 0
}
// For every available thread a bit is set in the mask.
ncpu := int(popcnt(uint64(mask)))
return ncpu
return bits.OnesCount64(uint64(mask))
}
32 changes: 0 additions & 32 deletions pkg/sysinfo/nummem_linux.go

This file was deleted.

9 changes: 0 additions & 9 deletions pkg/sysinfo/nummem_unsupported.go

This file was deleted.

10 changes: 0 additions & 10 deletions pkg/sysinfo/sysinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,6 @@ func isCpusetListAvailable(provided, available string) (bool, error) {
return true, nil
}

// Returns bit count of 1, used by NumCPU
func popcnt(x uint64) (n byte) {
x -= (x >> 1) & 0x5555555555555555
x = (x>>2)&0x3333333333333333 + x&0x3333333333333333
x += x >> 4
x &= 0x0f0f0f0f0f0f0f0f
x *= 0x0101010101010101
return byte(x >> 56)
}

// GetDefaultPidsLimit returns the default pids limit to run containers with
func GetDefaultPidsLimit() int64 {
sysInfo := New(true)
Expand Down
10 changes: 0 additions & 10 deletions pkg/sysinfo/sysinfo_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,3 @@ func TestNumCPU(t *testing.T) {
t.Fatal("CPU returned must be greater than zero")
}
}

func TestNumMems(t *testing.T) {
if _, err := os.Stat("/proc/self/numa_maps"); !errors.Is(err, os.ErrNotExist) {
t.Skip("NUMA must be supported")
}
cpuMems := NUMANodeCount()
if cpuMems < 0 {
t.Fatal("Invalid number of memory nodes, must be 0 or greater.")
}
}