From: Peter Zijlstra <peterz@infradead.org>
To: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org,
Kan Liang <kan.liang@linux.intel.com>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 2/7] perf/cgroup: order events in RB tree by cgroup id
Date: Mon, 8 Jul 2019 17:38:55 +0200 [thread overview]
Message-ID: <20190708153855.GC3419@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190702065955.165738-3-irogers@google.com>
On Mon, Jul 01, 2019 at 11:59:50PM -0700, Ian Rogers wrote:
> @@ -1530,6 +1530,32 @@ perf_event_groups_less(struct perf_event *left, struct perf_event *right)
> if (left->cpu > right->cpu)
> return false;
>
> +#ifdef CONFIG_CGROUP_PERF
> + if (left->cgrp != right->cgrp) {
> + if (!left->cgrp)
> + /*
> + * Left has no cgroup but right does, no cgroups come
> + * first.
> + */
> + return true;
> + if (!right->cgrp)
> + /*
> + * Right has no cgroup but left does, no cgroups come
> + * first.
> + */
> + return false;
Per CodingStyle any multi-line statement (here due to comments) needs {
}.
> + if (left->cgrp->css.cgroup != right->cgrp->css.cgroup) {
> + if (!left->cgrp->css.cgroup)
> + return true;
> + if (!right->cgrp->css.cgroup)
> + return false;
> + /* Two dissimilar cgroups, order by id. */
> + return left->cgrp->css.cgroup->id <
> + right->cgrp->css.cgroup->id;
> + }
This is dis-similar to the existing style ( < true, > false, ==
fall-through).
Can all this be written like:
if (!left->cgrp || !left->cgrp.css.cgroup)
return true;
if (!right->cgrp || !right->cgrp.css.cgroup)
return false;
if (left->cgrp->css.cgroup->id < right->cgrp->css.cgroup->id)
retun true;
if (left->cgrp->css.cgroup->id > right->cgrp->css.cgroup->id)
return false;
?
> + }
> +#endif
> +
> if (left->group_index < right->group_index)
> return true;
> if (left->group_index > right->group_index)
next prev parent reply other threads:[~2019-07-08 15:39 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-02 6:59 [PATCH 0/7] Optimize cgroup context switch Ian Rogers
2019-07-02 6:59 ` [PATCH 1/7] perf: propagate perf_install_in_context errors up Ian Rogers
2019-07-05 14:13 ` Jiri Olsa
2019-07-02 6:59 ` [PATCH 2/7] perf/cgroup: order events in RB tree by cgroup id Ian Rogers
2019-07-08 15:38 ` Peter Zijlstra [this message]
2019-07-08 15:45 ` Peter Zijlstra
2019-07-08 16:16 ` Peter Zijlstra
2019-07-24 22:34 ` Ian Rogers
2019-07-08 16:21 ` Peter Zijlstra
2019-07-02 6:59 ` [PATCH 3/7] perf: order iterators for visit_groups_merge into a min-heap Ian Rogers
2019-07-08 16:30 ` Peter Zijlstra
2019-07-24 22:34 ` Ian Rogers
2019-07-08 16:36 ` Peter Zijlstra
2019-07-02 6:59 ` [PATCH 4/7] perf: avoid a bounded set of visit_groups_merge iterators Ian Rogers
2019-07-02 6:59 ` [PATCH 5/7] perf: cache perf_event_groups_first for cgroups Ian Rogers
2019-07-08 16:50 ` Peter Zijlstra
2019-07-08 16:51 ` Peter Zijlstra
2019-07-02 6:59 ` [PATCH 6/7] perf: avoid double checking CPU and cgroup Ian Rogers
2019-07-02 6:59 ` [PATCH 7/7] perf: rename visit_groups_merge to ctx_groups_sched_in Ian Rogers
2019-07-24 22:37 ` [PATCH v2 0/7] Optimize cgroup context switch Ian Rogers
2019-07-24 22:37 ` [PATCH v2 1/7] perf: propagate perf_install_in_context errors up Ian Rogers
2019-07-24 22:37 ` [PATCH v2 2/7] perf/cgroup: order events in RB tree by cgroup id Ian Rogers
2020-03-06 14:42 ` [tip: perf/core] perf/cgroup: Order " tip-bot2 for Ian Rogers
2019-07-24 22:37 ` [PATCH v2 3/7] perf: order iterators for visit_groups_merge into a min-heap Ian Rogers
2019-07-24 22:37 ` [PATCH v2 4/7] perf: avoid a bounded set of visit_groups_merge iterators Ian Rogers
2019-08-07 21:11 ` Peter Zijlstra
2019-07-24 22:37 ` [PATCH v2 5/7] perf: cache perf_event_groups_first for cgroups Ian Rogers
2019-07-24 22:37 ` [PATCH v2 6/7] perf: avoid double checking CPU and cgroup Ian Rogers
2019-07-24 22:37 ` [PATCH v2 7/7] perf: rename visit_groups_merge to ctx_groups_sched_in Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190708153855.GC3419@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome