hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/kernel/bpf/bpf_lru_list.h
....@@ -64,11 +64,8 @@
6464
6565 static inline void bpf_lru_node_set_ref(struct bpf_lru_node *node)
6666 {
67
- /* ref is an approximation on access frequency. It does not
68
- * have to be very accurate. Hence, no protection is used.
69
- */
70
- if (!node->ref)
71
- node->ref = 1;
67
+ if (!READ_ONCE(node->ref))
68
+ WRITE_ONCE(node->ref, 1);
7269 }
7370
7471 int bpf_lru_init(struct bpf_lru *lru, bool percpu, u32 hash_offset,