On Thu, 8 Sep 2016, Fenghua Yu wrote: > Normally each task is associated with one rdtgroup and we use the schema > for that rdtgroup whenever the task is running. The user can designate > some cpus to always use the same schema, regardless of which task is > running. To do that the user write a cpumask bit string to the "cpus" > file.
Is that just a left over of the previous series or am I completely confused by now? > +static int cpus_validate(struct cpumask *cpumask, struct rdtgroup *rdtgrp) > +{ > + int old_cpumask_bit, new_cpumask_bit; > + int cpu; > + > + for_each_online_cpu(cpu) { > + old_cpumask_bit = cpumask_test_cpu(cpu, &rdtgrp->cpu_mask); > + new_cpumask_bit = cpumask_test_cpu(cpu, cpumask); > + /* Cannot clear a "cpus" bit in a rdtgroup. */ > + if (old_cpumask_bit == 1 && new_cpumask_bit == 0) > + return -EINVAL; > + } > + > + /* If a cpu is not online, cannot set it. */ > + for_each_cpu(cpu, cpumask) { > + if (!cpu_online(cpu)) > + return -EINVAL; > + } cpumask_intersects() exists for a reason. And how is this protected against cpu hotplug? > + list_for_each(l, &rdtgroup_lists) { > + r = list_entry(l, struct rdtgroup, rdtgroup_list); > + if (r == rdtgrp) > + continue; > + > + for_each_cpu_and(cpu, &r->cpu_mask, cpumask) > + cpumask_clear_cpu(cpu, &r->cpu_mask); This code clearly predates the invention of cpumask_andnot() Thanks, tglx