Re: [PATCH bpf-next v2 10/11] bpf: libbpf: Add STRUCT_OPS support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux