Lines Matching +full:i +full:- +full:leak +full:- +full:current

1 // SPDX-License-Identifier: GPL-2.0
68 /* *key == 0 - the callback was called for array timer. in timer_cb1()
69 * *key == 4 - the callback was called from lru timer. in timer_cb1()
86 int lru_key, i; in timer_cb1() local
88 for (i = LRU + 1; in timer_cb1()
89 i <= 100 /* for current LRU eviction algorithm this number in timer_cb1()
90 * should be larger than ~ lru->max_entries * 2 in timer_cb1()
92 i++) { in timer_cb1()
98 lru_key = i; in timer_cb1()
100 /* add more elements into lru map to push out current in timer_cb1()
115 if (bpf_timer_cancel(timer) != -EINVAL) in timer_cb1()
145 * doesn't leak timer memory. in BPF_PROG()
155 /* callback for prealloc and non-prealloca hashtab timers */
159 callback_check--; in timer_cb2()
161 callback2_check--; in timer_cb2()
162 if (val->counter > 0 && --val->counter) { in timer_cb2()
163 /* re-arm the timer again to execute after 1 usec */ in timer_cb2()
164 bpf_timer_start(&val->timer, 1000, 0); in timer_cb2()
182 if (bpf_timer_cancel(&val->timer) != -EDEADLK) in timer_cb2()
193 * It's not a use-after-free. The memory is owned by the map. in timer_cb2()
195 if (bpf_timer_start(&val->timer, 1000, 0) != -EINVAL) in timer_cb2()
203 if (bpf_timer_cancel(&val->timer) != -EDEADLK) in timer_cb2()
211 /* in non-preallocated hashmap both 'key' and 'val' are RCU in timer_cb2()
220 if (bpf_timer_start(&val->timer, 1ull << 35, 0) != 0) in timer_cb2()
234 if (bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME) != 0) in bpf_timer_test()
236 bpf_timer_set_callback(&val->timer, timer_cb2); in bpf_timer_test()
237 bpf_timer_start(&val->timer, 1000, 0); in bpf_timer_test()
241 if (bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME) != 0) in bpf_timer_test()
243 bpf_timer_set_callback(&val->timer, timer_cb2); in bpf_timer_test()
244 bpf_timer_start(&val->timer, 1000, 0); in bpf_timer_test()
259 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG()
266 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG()
271 * don't leak timer memory. in BPF_PROG()
277 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG()
282 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG()
284 /* and with non-prealloc htab */ in BPF_PROG()
289 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG()
294 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG()