Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1690207
| From | Alexander Shishkin <alexander.shishkin@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups |
| Date | 2017-07-18 14:10 +0200 |
| Message-ID | <u4zu9-2f6-11@gated-at.bofh.it> (permalink) |
| References | <u1GBP-5sk-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Alexey Budankov <alexey.budankov@linux.intel.com> writes:
> +static void
> +perf_event_groups_rotate(struct perf_event_groups *groups, int cpu)
> +{
> + struct rb_node *node;
> + struct perf_event *node_event;
> +
> + WARN_ON_ONCE(!groups);
This seems redundant.
> +
> + list_rotate_left(&groups->list);
> +
> + /* will replace rotation above in patch v5 3/4
> +
> + node = groups->tree.rb_node;
> +
> + while (node) {
> + node_event = container_of(node,
> + struct perf_event, group_node);
> +
> + if (cpu < node_event->cpu) {
> + node = node->rb_left;
> + } else if (cpu > node_event->cpu) {
> + node = node->rb_right;
> + } else {
> + list_rotate_left(&node_event->group_list);
> + break;
> + }
> + }
> +
> + */
Please don't do this, it doesn't add clarity.
> +static int
> +perf_event_groups_iterate(struct perf_event_groups *groups,
> + perf_event_groups_iterate_f callback, void *data)
> +{
> + int ret = 0;
> + struct perf_event *event;
> +
> + WARN_ON_ONCE(!groups);
> +
> + list_for_each_entry(event, &groups->list, group_list_entry) {
> + ret = callback(event, data);
> + if (ret)
> + break;
> + }
> +
> + /* will replace itration above in patch v5 4/4
> +
> + for (node = rb_first(groups); node; node = rb_next(node)) {
> + node_event = container_of(node, struct perf_event, group_node);
> + list_for_each_entry(event, &node_event->group_list,
> + group_list_entry) {
> + WARN_ON_ONCE(!(event->cpu == node_event->cpu));
> + ret = callback(event, data);
> + if (ret) {
> + return ret;
> + }
> + }
> + }
> +
> + */
Ditto.
Regards,
--
Alex
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-07-10 15:10 +0200
Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-07-18 14:10 +0200
Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-07-18 15:40 +0200
Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-07-18 14:30 +0200
Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-07-18 15:40 +0200
Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-07-19 08:40 +0200
csiph-web