diff options
author | Hou Tao <houtao1@huawei.com> | 2023-12-04 22:04:23 +0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-12-04 17:50:26 -0800 |
commit | af66bfd3c8538ed21cf72af18426fc4a408665cf (patch) | |
tree | 3171b12b303ea941f111d3f6769257e44fc08104 /drivers/watchdog/gxp-wdt.c | |
parent | 876673364161da50eed6b472d746ef88242b2368 (diff) | |
download | linux-stable-af66bfd3c8538ed21cf72af18426fc4a408665cf.tar.gz linux-stable-af66bfd3c8538ed21cf72af18426fc4a408665cf.tar.bz2 linux-stable-af66bfd3c8538ed21cf72af18426fc4a408665cf.zip |
bpf: Optimize the free of inner map
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. Although the
max number of bpf program is INT_MAX - 1, the number of bpf programs
which are being loaded may be greater than INT_MAX, so using atomic64_t
instead of atomic_t 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.
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20231204140425.1480317-6-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'drivers/watchdog/gxp-wdt.c')
0 files changed, 0 insertions, 0 deletions