lkml.org 
[lkml]   [2019]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 perf,bpf 08/15] perf, bpf: save btf in a rbtree in perf_env
On Tue, Mar 05, 2019 at 11:13:52PM -0800, Song Liu wrote:

SNIP

> /* purge data in bpf_progs.infos tree */
> static void perf_env__purge_bpf(struct perf_env *env)
> {
> @@ -82,6 +133,19 @@ static void perf_env__purge_bpf(struct perf_env *env)
> rb_erase_init(&node->rb_node, root);
> free(node);
> }
> +
> + root = &env->bpf_progs.btfs;
> + next = rb_first(root);
> +
> + while (next) {
> + struct btf_node *node;
> +
> + node = rb_entry(next, struct btf_node, rb_node);
> + next = rb_next(&node->rb_node);
> + rb_erase_init(&node->rb_node, root);

hum rb_erase should be enough when we are removingfreeing the node right
after.. also for the struct bpf_prog_info_node up

jirka

> + free(node);
> + }

SNIP

\
 
 \ /
  Last update: 2019-03-07 15:07    [W:0.192 / U:12.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site