linux/kernel/bpf
Martin KaFai Lau a47eabf216 bpf: Repurpose use_trace_rcu to reuse_now in bpf_local_storage
This patch re-purpose the use_trace_rcu to mean
if the freed memory can be reused immediately or not.
The use_trace_rcu is renamed to reuse_now. Other than
the boolean test is reversed, it should be a no-op.

The following explains the reason for the rename and how it will
be used in a later patch.

In a later patch, bpf_mem_cache_alloc/free will be used
in the bpf_local_storage. The bpf mem allocator will reuse
the freed memory immediately. Some of the free paths in
bpf_local_storage does not support memory to be reused immediately.
These paths are the "delete" elem cases from the bpf_*_storage_delete()
helper and the map_delete_elem() syscall. Note that "delete" elem
before the owner's (sk/task/cgrp/inode) lifetime ended is not
the common usage for the local storage.

The common free path, bpf_local_storage_destroy(), can reuse the
memory immediately. This common path means the storage stays with
its owner until the owner is destroyed.

The above mentioned "delete" elem paths that cannot
reuse immediately always has the 'use_trace_rcu ==  true'.
The cases that is safe for immediate reuse always have
'use_trace_rcu == false'. Instead of adding another arg
in a later patch, this patch re-purpose this arg
to reuse_now and have the test logic reversed.

In a later patch, 'reuse_now == true' will free to the
bpf_mem_cache_free() where the memory can be reused
immediately. 'reuse_now == false' will go through the
call_rcu_tasks_trace().

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20230308065936.1550103-7-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-03-10 11:05:28 -08:00
..
preload bpf: iterators: Split iterators.lskel.h into little- and big- endian versions 2023-01-28 12:45:15 -08:00
arraymap.c bpf: arraymap memory usage 2023-03-07 09:33:42 -08:00
bloom_filter.c bpf: bloom_filter memory usage 2023-03-07 09:33:42 -08:00
bpf_cgrp_storage.c bpf: Repurpose use_trace_rcu to reuse_now in bpf_local_storage 2023-03-10 11:05:28 -08:00
bpf_inode_storage.c bpf: Repurpose use_trace_rcu to reuse_now in bpf_local_storage 2023-03-10 11:05:28 -08:00
bpf_iter.c bpf: implement numbers iterator 2023-03-08 16:19:51 -08:00
bpf_local_storage.c bpf: Repurpose use_trace_rcu to reuse_now in bpf_local_storage 2023-03-10 11:05:28 -08:00
bpf_lru_list.c
bpf_lru_list.h
bpf_lsm.c bpf: Fix the kernel crash caused by bpf_setsockopt(). 2023-01-26 23:26:40 -08:00
bpf_struct_ops.c bpf: bpf_struct_ops memory usage 2023-03-07 09:33:43 -08:00
bpf_struct_ops_types.h
bpf_task_storage.c bpf: Repurpose use_trace_rcu to reuse_now in bpf_local_storage 2023-03-10 11:05:28 -08:00
btf.c bpf: add iterator kfuncs registration and validation logic 2023-03-08 16:19:50 -08:00
cgroup.c bpf: allow ctx writes using BPF_ST_MEM instruction 2023-03-03 21:41:46 -08:00
cgroup_iter.c bpf: Pin the start cgroup in cgroup_iter_seq_init() 2022-11-21 17:40:42 +01:00
core.c bpf: add missing header file include 2023-02-22 09:52:32 -08:00
cpumap.c bpf: cpumap memory usage 2023-03-07 09:33:42 -08:00
cpumask.c bpf: Refactor RCU enforcement in the verifier. 2023-03-03 17:42:20 +01:00
devmap.c bpf: devmap memory usage 2023-03-07 09:33:42 -08:00
disasm.c
disasm.h
dispatcher.c bpf: Synchronize dispatcher update with bpf_dispatcher_xdp_func 2022-12-14 12:02:14 -08:00
hashtab.c bpf: hashtab memory usage 2023-03-07 09:33:42 -08:00
helpers.c bpf: implement numbers iterator 2023-03-08 16:19:51 -08:00
inode.c fs: port inode_init_owner() to mnt_idmap 2023-01-19 09:24:28 +01:00
Kconfig
link_iter.c
local_storage.c bpf: local_storage memory usage 2023-03-07 09:33:43 -08:00
lpm_trie.c bpf: lpm_trie memory usage 2023-03-07 09:33:42 -08:00
Makefile bpf: Enable cpumasks to be queried and used as kptrs 2023-01-25 07:57:49 -08:00
map_in_map.c bpf: Add comments for map BTF matching requirement for bpf_list_head 2022-11-17 19:22:14 -08:00
map_in_map.h
map_iter.c
memalloc.c bpf: Zeroing allocated object from slab in bpf memory allocator 2023-02-15 15:40:06 -08:00
mmap_unlock_work.h
net_namespace.c
offload.c bpf: offload map memory usage 2023-03-07 09:33:43 -08:00
percpu_freelist.c bpf: Initialize same number of free nodes for each pcpu_freelist 2022-11-11 12:05:14 -08:00
percpu_freelist.h
prog_iter.c
queue_stack_maps.c bpf: queue_stack_maps memory usage 2023-03-07 09:33:42 -08:00
reuseport_array.c bpf: reuseport_array memory usage 2023-03-07 09:33:42 -08:00
ringbuf.c bpf: ringbuf memory usage 2023-03-07 09:33:42 -08:00
stackmap.c bpf: stackmap memory usage 2023-03-07 09:33:42 -08:00
syscall.c bpf: enforce all maps having memory usage callback 2023-03-07 09:33:43 -08:00
sysfs_btf.c
task_iter.c bpf: keep a reference to the mm, in case the task is dead. 2022-12-28 14:11:48 -08:00
tnum.c
trampoline.c bpf: Fix panic due to wrong pageattr of im->image 2022-12-28 13:46:28 -08:00
verifier.c bpf: take into account liveness when propagating precision 2023-03-10 10:11:42 -08:00