Skip to content

Commit 9147efc

Browse files
edumazetAlexei Starovoitov
authored andcommitted
bpf: add schedule points to map alloc/free
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]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 9dbd2d9 commit 9147efc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/hashtab.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ static void htab_free_elems(struct bpf_htab *htab)
114114
pptr = htab_elem_get_ptr(get_htab_elem(htab, i),
115115
htab->map.key_size);
116116
free_percpu(pptr);
117+
cond_resched();
117118
}
118119
free_elems:
119120
bpf_map_area_free(htab->elems);
@@ -159,6 +160,7 @@ static int prealloc_init(struct bpf_htab *htab)
159160
goto free_elems;
160161
htab_elem_set_ptr(get_htab_elem(htab, i), htab->map.key_size,
161162
pptr);
163+
cond_resched();
162164
}
163165

164166
skip_percpu_elems:

0 commit comments

Comments
 (0)