summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2023-03-03 17:15:42 +0300
committerMartin KaFai Lau <martin.lau@kernel.org>2023-03-03 20:45:27 +0300
commite768e3c5aab44ee63f58649d4c8cbbb3270e5c06 (patch)
tree8cbf80f196feba40d3f6875151593bef55010743 /include/linux
parentdb55174d05ee6bed9d0583ba08e99c891ef0ed05 (diff)
downloadlinux-e768e3c5aab44ee63f58649d4c8cbbb3270e5c06.tar.xz
bpf: Use separate RCU callbacks for freeing selem
Martin suggested that instead of using a byte in the hole (which he has a use for in his future patch) in bpf_local_storage_elem, we can dispatch a different call_rcu callback based on whether we need to free special fields in bpf_local_storage_elem data. The free path, described in commit 9db44fdd8105 ("bpf: Support kptrs in local storage maps"), only waits for call_rcu callbacks when there are special (kptrs, etc.) fields in the map value, hence it is necessary that we only access smap in this case. Therefore, dispatch different RCU callbacks based on the BPF map has a valid btf_record, which dereference and use smap's btf_record only when it is valid. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20230303141542.300068-1-memxor@gmail.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bpf_local_storage.h6
1 files changed, 0 insertions, 6 deletions
diff --git a/include/linux/bpf_local_storage.h b/include/linux/bpf_local_storage.h
index 0fe92986412b..6d37a40cd90e 100644
--- a/include/linux/bpf_local_storage.h
+++ b/include/linux/bpf_local_storage.h
@@ -74,12 +74,6 @@ struct bpf_local_storage_elem {
struct hlist_node snode; /* Linked to bpf_local_storage */
struct bpf_local_storage __rcu *local_storage;
struct rcu_head rcu;
- bool can_use_smap; /* Is it safe to access smap in bpf_selem_free_* RCU
- * callbacks? bpf_local_storage_map_free only
- * executes rcu_barrier when there are special
- * fields, this field remembers that to ensure we
- * don't access already freed smap in sdata.
- */
/* 8 bytes hole */
/* The data is stored in another cacheline to minimize
* the number of cachelines access during a cache hit.