bpf: add schedule points to map alloc/free
Subsystems (3)
PATCH 1/1 bpf: add schedule points to map alloc/free
From: Eric Dumazet <[email protected]>
While using large percpu maps, htab_map_alloc() can hold cpu for hundreds of ms.
This patch adds cond_resched() calls to percpu alloc/free call sites, all running in process context.
Signed-off-by Eric Dumazet <[email protected]>
---
kernel/bpf/hashtab.c | 2 ++
1 file changed, 2 insertions(+)
kernel/bpf/hashtab.c +2 -0
@@ -114,6 +114,7 @@ static void htab_free_elems(struct bpf_htab *htab) pptr =htab_elem_get_ptr (get_htab_elem (htab, i), htab->map.key_size);free_percpu (pptr); +cond_resched (); } free_elems:bpf_map_area_free (htab->elems);
@@ -159,6 +160,7 @@ static int prealloc_init(struct bpf_htab *htab) goto free_elems;htab_elem_set_ptr (get_htab_elem (htab, i), htab->map.key_size, pptr); +cond_resched (); } skip_percpu_elems:
Alexei Starovoitov
AppliedQuoted 9 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
While using large percpu maps,
htab_map_alloc()can hold cpu for hundreds of ms.This patch adds
cond_resched()calls to percpu alloc/free call sites, all running in process context.Signed-off-by Eric Dumazet <[email protected]>
Applied, thanks Eric!