[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191226224735.7q3ry3k6avxftpxv@kafai-mbp>
Date: Thu, 26 Dec 2019 22:47:40 +0000
From: Martin Lau <kafai@...com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
CC: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
"Daniel Borkmann" <daniel@...earbox.net>,
David Miller <davem@...emloft.net>,
"Kernel Team" <Kernel-team@...com>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2 10/11] bpf: libbpf: Add STRUCT_OPS support
On Mon, Dec 23, 2019 at 11:54:17AM -0800, Andrii Nakryiko wrote:
> > - for (i = 0; i < obj->nr_maps; i++)
> > + for (i = 0; i < obj->nr_maps; i++) {
> > zclose(obj->maps[i].fd);
> > + if (obj->maps[i].st_ops)
> > + zfree(&obj->maps[i].st_ops->kern_vdata);
>
> any specific reason to deallocate only kern_vdata? maybe just
> consolidate all the clean up in bpf_object__close instead?
I think it is the same as why the map fd is closed here.
kern_vdata is allocated at load time, so it seems more
logical to me to deallocate asap at unload time.
For example, if user calls bpf_object__load_xattr()
and one of the load steps fails, bpf_object__unload
(but not bpf_object__close) is called before returning.
Powered by blists - more mailing lists