mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 12:14:10 +08:00
cgroup/cpuset: Account for boot time isolated CPUs
With the "isolcpus" boot command line parameter, we are able to create isolated CPUs at boot time. These isolated CPUs aren't fully accounted for in the cpuset code. For instance, the root cgroup's "cpuset.cpus.isolated" control file does not include the boot time isolated CPUs. Fix that by looking for pre-isolated CPUs at init time. The prstate_housekeeping_conflict() function does check the HK_TYPE_DOMAIN housekeeping cpumask to make sure that CPUs outside of it can only be used in isolated partition. Given the fact that we are going to make housekeeping cpumasks dynamic, the current check may not be right anymore. Save the boot time HK_TYPE_DOMAIN cpumask and check against it instead of the upcoming dynamic HK_TYPE_DOMAIN housekeeping cpumask. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
3c2acae888
commit
c188f33c86
@ -224,6 +224,12 @@ static cpumask_var_t subpartitions_cpus;
|
||||
*/
|
||||
static cpumask_var_t isolated_cpus;
|
||||
|
||||
/*
|
||||
* Housekeeping (HK_TYPE_DOMAIN) CPUs at boot
|
||||
*/
|
||||
static cpumask_var_t boot_hk_cpus;
|
||||
static bool have_boot_isolcpus;
|
||||
|
||||
/* List of remote partition root children */
|
||||
static struct list_head remote_children;
|
||||
|
||||
@ -1823,15 +1829,15 @@ static void remote_partition_check(struct cpuset *cs, struct cpumask *newmask,
|
||||
* @new_cpus: cpu mask
|
||||
* Return: true if there is conflict, false otherwise
|
||||
*
|
||||
* CPUs outside of housekeeping_cpumask(HK_TYPE_DOMAIN) can only be used in
|
||||
* an isolated partition.
|
||||
* CPUs outside of boot_hk_cpus, if defined, can only be used in an
|
||||
* isolated partition.
|
||||
*/
|
||||
static bool prstate_housekeeping_conflict(int prstate, struct cpumask *new_cpus)
|
||||
{
|
||||
const struct cpumask *hk_domain = housekeeping_cpumask(HK_TYPE_DOMAIN);
|
||||
bool all_in_hk = cpumask_subset(new_cpus, hk_domain);
|
||||
if (!have_boot_isolcpus)
|
||||
return false;
|
||||
|
||||
if (!all_in_hk && (prstate != PRS_ISOLATED))
|
||||
if ((prstate != PRS_ISOLATED) && !cpumask_subset(new_cpus, boot_hk_cpus))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -4345,6 +4351,13 @@ int __init cpuset_init(void)
|
||||
|
||||
BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));
|
||||
|
||||
have_boot_isolcpus = housekeeping_enabled(HK_TYPE_DOMAIN);
|
||||
if (have_boot_isolcpus) {
|
||||
BUG_ON(!alloc_cpumask_var(&boot_hk_cpus, GFP_KERNEL));
|
||||
cpumask_copy(boot_hk_cpus, housekeeping_cpumask(HK_TYPE_DOMAIN));
|
||||
cpumask_andnot(isolated_cpus, cpu_possible_mask, boot_hk_cpus);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user