bpf: add schedule points in percpu arrays management
authorEric Dumazet <edumazet@google.com>
Thu, 8 Mar 2018 12:14:45 +0000 (13:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Mar 2018 15:23:22 +0000 (16:23 +0100)
commite1760b3563fb31877a6d625f53ac69f1f3074633
tree121e1fe83778844e894a9af02628d27ac55df37c
parent03549a3476e1c9b8b9a62105566f97743ffda0c0
bpf: add schedule points in percpu arrays management

[ upstream commit 32fff239de37ef226d5b66329dd133f64d63b22d ]

syszbot managed to trigger RCU detected stalls in
bpf_array_free_percpu()

It takes time to allocate a huge percpu map, but even more time to free
it.

Since we run in process context, use cond_resched() to yield cpu if
needed.

Fixes: a10423b87a7e ("bpf: introduce BPF_MAP_TYPE_PERCPU_ARRAY map")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/arraymap.c