Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1670772 > unrolled thread
| Started by | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| First post | 2017-06-20 15:40 +0200 |
| Last post | 2017-06-20 19:20 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Mark Rutland <mark.rutland@arm.com> - 2017-06-20 15:40 +0200
Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-06-20 17:30 +0200
Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Mark Rutland <mark.rutland@arm.com> - 2017-06-20 18:40 +0200
Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Alexey Budankov <alexey.budankov@linux.intel.com> - 2017-06-20 19:20 +0200
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2017-06-20 15:40 +0200 |
| Subject | Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi |
| Message-ID | <tUrxU-Mz-33@gated-at.bofh.it> |
On Mon, Jun 19, 2017 at 11:31:59PM +0300, Alexey Budankov wrote:
> On 15.06.2017 22:56, Mark Rutland wrote:
> >On Thu, Jun 15, 2017 at 08:41:42PM +0300, Alexey Budankov wrote:
> >>+static int
> >>+perf_cpu_tree_iterate(struct rb_root *tree,
> >>+ perf_cpu_tree_callback_t callback, void *data)
> >>+{
> >>+ int ret = 0;
> >>+ struct rb_node *node;
> >>+ struct perf_event *event;
> >>+
> >>+ WARN_ON_ONCE(!tree);
> >>+
> >>+ for (node = rb_first(tree); node; node = rb_next(node)) {
> >>+ struct perf_event *node_event = container_of(node,
> >>+ struct perf_event, group_node);
> >>+
> >>+ list_for_each_entry(event, &node_event->group_list,
> >>+ group_list_entry) {
> >>+ ret = callback(event, data);
> >>+ if (ret)
> >>+ return ret;
> >>+ }
> >>+ }
> >>+
> >>+ return 0;
> >> }
> >
> >If you need to iterate over every event, you can use the list that
> >threads the whole tree.
>
> Could you please explain more on that?
In Peter's original suggestion, we'd use a threaded tree rather than a
tree of lists.
i.e. you'd have something like:
struct threaded_rb_node {
struct rb_node node;
struct list_head head;
};
... with the tree and list covering all nodes, in the same order:
Tree:
3
/ \
/ \
1 5
/ \ / \
0 2 4 6
List:
0 - 1 - 2 - 3 - 4 - 5 - 6
... that way you can search using the tree, and iterate using the list,
even when you wan to iterate over sub-lists.
Thanks,
Mark.
[toc] | [next] | [standalone]
| From | Alexey Budankov <alexey.budankov@linux.intel.com> |
|---|---|
| Date | 2017-06-20 17:30 +0200 |
| Message-ID | <tUtgm-1UJ-25@gated-at.bofh.it> |
| In reply to | #1670772 |
On 20.06.2017 16:36, Mark Rutland wrote:
> On Mon, Jun 19, 2017 at 11:31:59PM +0300, Alexey Budankov wrote:
>> On 15.06.2017 22:56, Mark Rutland wrote:
>>> On Thu, Jun 15, 2017 at 08:41:42PM +0300, Alexey Budankov wrote:
>>>> +static int
>>>> +perf_cpu_tree_iterate(struct rb_root *tree,
>>>> + perf_cpu_tree_callback_t callback, void *data)
>>>> +{
>>>> + int ret = 0;
>>>> + struct rb_node *node;
>>>> + struct perf_event *event;
>>>> +
>>>> + WARN_ON_ONCE(!tree);
>>>> +
>>>> + for (node = rb_first(tree); node; node = rb_next(node)) {
>>>> + struct perf_event *node_event = container_of(node,
>>>> + struct perf_event, group_node);
>>>> +
>>>> + list_for_each_entry(event, &node_event->group_list,
>>>> + group_list_entry) {
>>>> + ret = callback(event, data);
>>>> + if (ret)
>>>> + return ret;
>>>> + }
>>>> + }
>>>> +
>>>> + return 0;
>>>> }
>>>
>>> If you need to iterate over every event, you can use the list that
>>> threads the whole tree.
>>
>> Could you please explain more on that?
>
> In Peter's original suggestion, we'd use a threaded tree rather than a
> tree of lists.
>
> i.e. you'd have something like:
>
> struct threaded_rb_node {
> struct rb_node node;
> struct list_head head;
> };
Is this for every group leader? Which objects does the head keep?
>
> ... with the tree and list covering all nodes, in the same order:
>
> Tree:
>
> 3
> / \
> / \
> 1 5
> / \ / \
> 0 2 4 6
>
> List:
>
> 0 - 1 - 2 - 3 - 4 - 5 - 6
>
> ... that way you can search using the tree, and iterate using the list,
> even when you wan to iterate over sub-lists.
>
> Thanks,
> Mark.
>
[toc] | [prev] | [next] | [standalone]
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2017-06-20 18:40 +0200 |
| Message-ID | <tUum6-2zG-31@gated-at.bofh.it> |
| In reply to | #1670869 |
On Tue, Jun 20, 2017 at 06:22:56PM +0300, Alexey Budankov wrote:
> On 20.06.2017 16:36, Mark Rutland wrote:
> >On Mon, Jun 19, 2017 at 11:31:59PM +0300, Alexey Budankov wrote:
> >>On 15.06.2017 22:56, Mark Rutland wrote:
> >>>On Thu, Jun 15, 2017 at 08:41:42PM +0300, Alexey Budankov wrote:
> >>>>+static int
> >>>>+perf_cpu_tree_iterate(struct rb_root *tree,
> >>>>+ perf_cpu_tree_callback_t callback, void *data)
> >>>>+{
> >>>>+ int ret = 0;
> >>>>+ struct rb_node *node;
> >>>>+ struct perf_event *event;
> >>>>+
> >>>>+ WARN_ON_ONCE(!tree);
> >>>>+
> >>>>+ for (node = rb_first(tree); node; node = rb_next(node)) {
> >>>>+ struct perf_event *node_event = container_of(node,
> >>>>+ struct perf_event, group_node);
> >>>>+
> >>>>+ list_for_each_entry(event, &node_event->group_list,
> >>>>+ group_list_entry) {
> >>>>+ ret = callback(event, data);
> >>>>+ if (ret)
> >>>>+ return ret;
> >>>>+ }
> >>>>+ }
> >>>>+
> >>>>+ return 0;
> >>>> }
> >>>
> >>>If you need to iterate over every event, you can use the list that
> >>>threads the whole tree.
> >>
> >>Could you please explain more on that?
> >
> >In Peter's original suggestion, we'd use a threaded tree rather than a
> >tree of lists.
> >
> >i.e. you'd have something like:
> >
> >struct threaded_rb_node {
> > struct rb_node node;
> > struct list_head head;
> >};
>
> Is this for every group leader?
Yes; *every* group leader would be directly in the threaded rb tree.
> Which objects does the head keep?
Sorry, I'm not sure how to answer that. Did the above clarify?
If not, could you rephrase the question?
Thanks,
Mark.
[toc] | [prev] | [next] | [standalone]
| From | Alexey Budankov <alexey.budankov@linux.intel.com> |
|---|---|
| Date | 2017-06-20 19:20 +0200 |
| Message-ID | <tUuYO-32j-7@gated-at.bofh.it> |
| In reply to | #1670936 |
On 20.06.2017 19:37, Mark Rutland wrote:
> On Tue, Jun 20, 2017 at 06:22:56PM +0300, Alexey Budankov wrote:
>> On 20.06.2017 16:36, Mark Rutland wrote:
>>> On Mon, Jun 19, 2017 at 11:31:59PM +0300, Alexey Budankov wrote:
>>>> On 15.06.2017 22:56, Mark Rutland wrote:
>>>>> On Thu, Jun 15, 2017 at 08:41:42PM +0300, Alexey Budankov wrote:
>>>>>> +static int
>>>>>> +perf_cpu_tree_iterate(struct rb_root *tree,
>>>>>> + perf_cpu_tree_callback_t callback, void *data)
>>>>>> +{
>>>>>> + int ret = 0;
>>>>>> + struct rb_node *node;
>>>>>> + struct perf_event *event;
>>>>>> +
>>>>>> + WARN_ON_ONCE(!tree);
>>>>>> +
>>>>>> + for (node = rb_first(tree); node; node = rb_next(node)) {
>>>>>> + struct perf_event *node_event = container_of(node,
>>>>>> + struct perf_event, group_node);
>>>>>> +
>>>>>> + list_for_each_entry(event, &node_event->group_list,
>>>>>> + group_list_entry) {
>>>>>> + ret = callback(event, data);
>>>>>> + if (ret)
>>>>>> + return ret;
>>>>>> + }
>>>>>> + }
>>>>>> +
>>>>>> + return 0;
>>>>>> }
>>>>>
>>>>> If you need to iterate over every event, you can use the list that
>>>>> threads the whole tree.
>>>>
>>>> Could you please explain more on that?
>>>
>>> In Peter's original suggestion, we'd use a threaded tree rather than a
>>> tree of lists.
>>>
>>> i.e. you'd have something like:
>>>
>>> struct threaded_rb_node {
>>> struct rb_node node;
>>> struct list_head head;
>>> };
>>
>> Is this for every group leader?
>
> Yes; *every* group leader would be directly in the threaded rb tree.
In this case the tree's key heeds to be something trickier than just
event->cpu. To avoid that complication group_list is introduced. BTW,
addressing perf_event_tree_delete issue doesn't look like a big change now:
static void
perf_cpu_tree_delete(struct rb_root *tree, struct perf_event *event)
{
struct perf_event *next;
WARN_ON_ONCE(!tree || !event);
list_del_init(&event->group_entry);
if (!RB_EMPTY_NODE(&event->group_node)) {
if (!list_empty(&event->group_list)) {
next = list_first_entry(&event->group_list,
struct perf_event, group_entry);
list_replace_init(&event->group_list,
&next->group_list);
rb_replace_node(&event->group_node,
&next->group_node, tree);
} else {
rb_erase(&event->group_node, tree);
}
RB_CLEAR_NODE(&event->group_node);
}
}
>
>> Which objects does the head keep?
>
> Sorry, I'm not sure how to answer that. Did the above clarify?
>
> If not, could you rephrase the question?
>
> Thanks,
> Mark.
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web