Skip to content

Missing cgroups support #236

@rofafor

Description

@rofafor

The current CPU count detector in Linux only uses affinity:

static cpu_set_t OnlineCpus() {
cpu_set_t online_cpus;
CPU_ZERO(&online_cpus);
CHECK_EQ(0, sched_getaffinity(0, sizeof(online_cpus), &online_cpus));
return online_cpus;
}

Modern containerized systems require use of cgroups that is used to limit resource usage and therefore it should be taken account also in Helio's CPU detection. Please, take a look at e.g. OpenJDK's implementation: https://github.com/openjdk/jdk/blob/37c2279148fa91627137e3af362bfcffde61acd0/src/hotspot/os/linux/cgroupSubsystem_linux.cpp#L449-L513

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions