On Fri, 14 Oct 2016, Fenghua Yu wrote:
>  static int intel_rdt_offline_cpu(unsigned int cpu)
>  {
>       struct rdt_resource *r;
> +     struct rdtgroup *rdtgrp;
> +     struct list_head *l;
>  
>       mutex_lock(&rdtgroup_mutex);
>       for_each_rdt_resource(r)
>               update_domain(cpu, r, 0);
> +     list_for_each(l, &rdt_all_groups) {

list_for_each_entry ...

> +             rdtgrp = list_entry(l, struct rdtgroup, rdtgroup_list);
> +             if (cpumask_test_and_clear_cpu(cpu, &rdtgrp->cpu_mask))
> +                     break;

> +static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
> +                                char *buf, size_t nbytes, loff_t off)
> +{
     ....
> +     /* Are trying to drop some cpus from this group? */

        /* Check whether cpus are dropped from this group */

> +     cpumask_andnot(tmpmask, &rdtgrp->cpu_mask, newmask);
> +     if (cpumask_weight(tmpmask)) {
> +             /* Can't drop from default group */
> +             if (rdtgrp == &rdtgroup_default) {
> +                     ret = -EINVAL;
> +                     goto end;
> +             }
> +             /* Give any dropped cpus to rdtgroup_default */
> +             cpumask_or(&rdtgroup_default.cpu_mask,
> +                        &rdtgroup_default.cpu_mask, tmpmask);
> +             for_each_cpu(cpu, tmpmask)
> +                     per_cpu(cpu_closid, cpu) = 0;
> +     }
> +
> +     /*
> +      * If we added cpus, remove them from previous group that owned them
> +      * and update per-cpu rdtgroup pointers to refer to us

s/per-cpu rdtgroup pointers to refer to us/the per-cpu closid/

> +      */
> +     cpumask_andnot(tmpmask, newmask, &rdtgrp->cpu_mask);
> +     if (cpumask_weight(tmpmask)) {
> +             struct list_head *l;
> +
> +             list_for_each(l, &rdt_all_groups) {
> +                     r = list_entry(l, struct rdtgroup, rdtgroup_list);

Once more: list_for_each_entry()

> @@ -582,6 +698,10 @@ static int rdtgroup_rmdir(struct kernfs_node *kn)
>               return -EPERM;
>       }
>  
> +     /* Give any CPUs back to the default group */
> +     cpumask_or(&rdtgroup_default.cpu_mask,
> +                &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask);

What resets the per-cpu closid to 0?

Thanks,

        tglx

Reply via email to