WL#16851: Support cpuset-cpus cgroup
This worklog adds support to handle the resource limitations set by the cpuset-cpus cgroup.
The cpuset-cpus cgroup provides a mechanism for assigning a set of CPUs to the application running in the cgroup. The Linux system call sched_getaffinity, which is used to fetch CPU affinity, already adheres to the restrictions imposed by the cpuset-cpus cgroup.
This worklog must count the number of logical CPUs provided by the cpuset-cpus cgroup controller when determining the number of logical CPUs available to the MySQL server.
Functional Requirements:
FR-1: When calculating the number of logical CPUs available to the MySQL Server, it must adhere to restrictions imposed by the cpuset-cpus cgroup controller, irrespective of the value of the system variable `container-aware`.
The current APIs used by the MySQL server to determine the number of logical CPUs must be modified to account for the restrictions set by the cpuset-cpus cgroup controller.
These are the ways to obtain this information:
- Using the sched_getaffinity system call
- Using the pthread_getaffinity_np
The method to read the number of logical CPUs using sched_getaffinity is already provided by the function `num_vcpus_using_affinity`. Thus, this worklog can be implemented by simply calling the function `num_vcpus_using_affinity` when determining the number of logical CPUs.