bpf: add schedule points in percpu arrays management
authorEric Dumazet <edumazet@google.com>
Thu, 8 Mar 2018 15:17:36 +0000 (16:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Mar 2018 15:21:35 +0000 (16:21 +0100)
commit2a8bc5316adc998951e8f726c31e231a6021eae2
tree2cd0a28879e41a86ca90701e896faa4f21224936
parent54c6d01b1a4fa674e70da842fef95382044dc1e4
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