Re: [PATCH bpf v4 5/7] bpf: Optimize the free of inner map

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

 



On Thu, Nov 30, 2023 at 10:01:18PM +0800, Hou Tao wrote:
> From: Hou Tao <houtao1@xxxxxxxxxx>
> 
> When removing the inner map from the outer map, the inner map will be
> freed after one RCU grace period and one RCU tasks trace grace
> period, so it is certain that the bpf program, which may access the
> inner map, has exited before the inner map is freed.
> 
> However there is no need to wait for one RCU tasks trace grace period if
> the outer map is only accessed by non-sleepable program. So adding
> sleepable_refcnt in bpf_map and increasing sleepable_refcnt when adding
> the outer map into env->used_maps for sleepable program. Considering the
> max number of bpf program is INT_MAX - 1, atomic_t instead of atomic64_t
> is used for sleepable_refcnt. When removing the inner map from the outer
> map, using sleepable_refcnt to decide whether or not a RCU tasks trace
> grace period is needed before freeing the inner map.

Optimizing too soon as usual?
I bet you saw that we use:
 atomic64_t refcnt
for bpf_map, but you probably didn't dig into git history and
missed commit 92117d8443bc ("bpf: fix refcnt overflow") ?





[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