Re: [PATCH RESEND v5] perf/core: Fix installing arbitrary cgroup event into cpu

From: Lin Xiulei
Date: Mon Mar 12 2018 - 07:46:59 EST


2018-03-12 15:53 GMT+08:00 Ingo Molnar <mingo@xxxxxxxxxx>:
>
> * linxiulei@xxxxxxxxx <linxiulei@xxxxxxxxx> wrote:
>
>> /*
>> * Because cgroup events are always per-cpu events,
>> * this will always be called from the right CPU.
>> */
>
>> + /*
>> + * if only the cgroup is running on this cpu
>> + * and cpuctx->cgrp == NULL (otherwise it would've
>> + * been set with running cgroup), we put this cgroup
>> + * into cpu context. Or it would case mismatch in
>> + * following cgroup events at event_filter_match()
>> + */
>
> Beyond making sure that what you comment on makes sense, please also follow
> existing comment style, which I quoted above.
>
> There's 3 separate mistakes in that paragraph alone.
>
> Thanks,
>
> Ingo

Thank Ingo for pointing it out. though I'd try to follow it as
possible as I could. I wish I have somewhere to check style with
specific documents : )

+ /*
+ * We will set cpuctx->cgrp only if:
+ * 1) cpuctx->cgrp is NULL. Because cpuctx->cgrp was set
+ * correctly by sched_in(). We don't need to set it again.
+ * 2) cgroup related to this event is running on this CPU.
+ * Otherwise it will fail in event_filter_match()
+ */

Peter, did I explain that logic clearly and prove it right?

Regards