Lines Matching +full:i +full:- +full:leak +full:- +full:current
1 // SPDX-License-Identifier: GPL-2.0
79 /* *key == 0 - the callback was called for array timer. in timer_cb1()
80 * *key == 4 - the callback was called from lru timer. in timer_cb1()
97 int lru_key, i; in timer_cb1() local
99 for (i = LRU + 1; in timer_cb1()
100 i <= 100 /* for current LRU eviction algorithm this number in timer_cb1()
101 * should be larger than ~ lru->max_entries * 2 in timer_cb1()
103 i++) { in timer_cb1()
109 lru_key = i; in timer_cb1()
111 /* add more elements into lru map to push out current in timer_cb1()
126 if (bpf_timer_cancel(timer) != -EINVAL) in timer_cb1()
156 * doesn't leak timer memory. in BPF_PROG2()
166 /* callback for prealloc and non-prealloca hashtab timers */
170 callback_check--; in timer_cb2()
172 callback2_check--; in timer_cb2()
173 if (val->counter > 0 && --val->counter) { in timer_cb2()
174 /* re-arm the timer again to execute after 1 usec */ in timer_cb2()
175 bpf_timer_start(&val->timer, 1000, 0); in timer_cb2()
193 if (bpf_timer_cancel(&val->timer) != -EDEADLK) in timer_cb2()
204 * It's not a use-after-free. The memory is owned by the map. in timer_cb2()
206 if (bpf_timer_start(&val->timer, 1000, 0) != -EINVAL) in timer_cb2()
214 if (bpf_timer_cancel(&val->timer) != -EDEADLK) 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_PROG2()
266 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
271 * don't leak timer memory. in BPF_PROG2()
277 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
282 bpf_timer_init(&val->timer, &hmap, CLOCK_BOOTTIME); in BPF_PROG2()
284 /* and with non-prealloc htab */ in BPF_PROG2()
289 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
294 bpf_timer_init(&val->timer, &hmap_malloc, CLOCK_BOOTTIME); in BPF_PROG2()
308 /* Re-arm timer ~35 seconds in future */ in timer_cb3()
416 if (err && err != -EBUSY) in race()