Re: [PATCH 4/9] perf: Generic intel uncore support

From: Yan, Zheng
Date: Fri May 11 2012 - 02:41:59 EST


On 05/11/2012 02:31 PM, Anshuman Khandual wrote:
> On Wednesday 02 May 2012 07:37 AM, Yan, Zheng wrote:
>
>> +static int __cpuinit uncore_cpu_prepare(int cpu)
>> +{
>> + struct intel_uncore_type *type;
>> + struct intel_uncore_pmu *pmu;
>> + struct intel_uncore_box *exist, *box;
>> + int i, j, phyid;
>> +
>> + phyid = topology_physical_package_id(cpu);
>> +
>> + /* allocate the box data structure */
>> + for (i = 0; msr_uncores[i]; i++) {
>> + type = msr_uncores[i];
>> + for (j = 0; j < type->num_boxes; j++) {
>> + exist = NULL;
>> + pmu = &type->pmus[j];
>> +
>> + if (pmu->func_id < 0)
>> + pmu->func_id = j;
>> + exist = uncore_pmu_find_box(pmu, phyid);
>> + if (exist)
>> + exist->refcnt++;
>> + if (exist)
>> + continue;
>
>
>
> May be a redundant condition checking ^ ?

Yes, it's redundant. I will remove it in later patches.

Regards
Yan, Zheng
>
>> +
>> + box = uncore_alloc_box(cpu);
>> + if (!box)
>> + return -ENOMEM;
>> +
>> + box->pmu = pmu;
>> + box->phy_id = phyid;
>> + uncore_pmu_add_box(pmu, box);
>> + }
>> + }
>> + return 0;
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/