Lines Matching +full:i +full:- +full:leak +full:- +full:current
1 // SPDX-License-Identifier: GPL-2.0
80 /* *key == 0 - the callback was called for array timer. in timer_cb1()
81 * *key == 4 - the callback was called from lru timer. in timer_cb1()
98 int lru_key, i; in timer_cb1() local
100 for (i = LRU + 1; in timer_cb1()
101 i <= 100 /* for current LRU eviction algorithm this number in timer_cb1()
102 * should be larger than ~ lru->max_entries * 2 in timer_cb1()
104 i++) { in timer_cb1()
110 lru_key = i; in timer_cb1()
112 /* add more elements into lru map to push out current in timer_cb1()
127 if (bpf_timer_cancel(timer) != -EINVAL) in timer_cb1()
157 * doesn't leak timer memory. in BPF_PROG2()
167 /* callback for prealloc and non-prealloca hashtab timers */
171 callback_check--; in timer_cb2()
173 callback2_check--; in timer_cb2()
174 if (val->counter > 0 && --val->counter) { in timer_cb2()
175 /* re-arm the timer again to execute after 1 usec */ in timer_cb2()
176 bpf_timer_start(&val->timer, 1000, 0); in timer_cb2()
194 if (bpf_timer_cancel(&val->timer) != -EDEADLK) in timer_cb2()
205 * It's not a use-after-free. The memory is owned by the map. in timer_cb2()
207 if (bpf_timer_start(&val->timer, 1000, 0) != -EINVAL) in timer_cb2()
215 if (bpf_timer_cancel(&val->timer) != -EDEADLK) in timer_cb2()
235 if (bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME) != 0) in bpf_timer_test()
237 bpf_timer_set_callback(&val->timer, timer_cb2); in bpf_timer_test()
238 bpf_timer_start(&val->timer, 1000, 0); in bpf_timer_test()
242 if (bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME) != 0) in bpf_timer_test()
244 bpf_timer_set_callback(&val->timer, timer_cb2); in bpf_timer_test()
245 bpf_timer_start(&val->timer, 1000, 0); in bpf_timer_test()
260 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
267 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
272 * don't leak timer memory. in BPF_PROG2()
278 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
283 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
285 /* and with non-prealloc htab */ in BPF_PROG2()
290 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
295 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
309 /* Re-arm timer ~35 seconds in future */ in timer_cb3()
417 if (err && err != -EBUSY) in race()