Re: [PATCH 2/2] perf pmu: Improve CPU core PMU HW event list ordering

From: John Garry
Date: Mon Jun 15 2020 - 10:52:49 EST


On 15/06/2020 15:36, Namhyung Kim wrote:>> static int cmp_sevent(const void *a, const void *b)
@@ -1416,6 +1417,12 @@ static int cmp_sevent(const void *a, const void *b)
if (n)
return n;
}
+
+ if (as->is_cpu && !bs->is_cpu)
+ return -1;
+ else if (!as->is_cpu && bs->is_cpu)
+ return 1;
+
This can be:

if (as->is_cpu != bs->is_cpu)
return bs->is_cpu - as->is_cpu;


That's more concise, but maybe not as readable at a glance. I don't mind though, so can change.

Thanks,
John