[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1610172315230.6407@nanos>
Date: Mon, 17 Oct 2016 23:27:59 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Fenghua Yu <fenghua.yu@...el.com>
cc: "H. Peter Anvin" <h.peter.anvin@...el.com>,
Ingo Molnar <mingo@...e.hu>, Tony Luck <tony.luck@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>,
Borislav Petkov <bp@...e.de>,
Dave Hansen <dave.hansen@...el.com>,
Nilay Vaish <nilayvaish@...il.com>, Shaohua Li <shli@...com>,
David Carrillo-Cisneros <davidcc@...gle.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
Sai Prakhya <sai.praneeth.prakhya@...el.com>,
Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [PATCH v4 14/18] x86/intel_rdt: Add cpus file
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
Powered by blists - more mailing lists