]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
bpf: Add schedule point in htab_init_buckets()
authorEric Dumazet <edumazet@google.com>
Mon, 21 Dec 2020 19:25:06 +0000 (11:25 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 21 Dec 2020 23:14:31 +0000 (00:14 +0100)
We noticed that with a LOCKDEP enabled kernel,
allocating a hash table with 65536 buckets would
use more than 60ms.

htab_init_buckets() runs from process context,
it is safe to schedule to avoid latency spikes.

Fixes: c50eb518e262 ("bpf: Use separate lockdep class for each hashtab")
Reported-by: John Sperbeck <jsperbeck@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20201221192506.707584-1-eric.dumazet@gmail.com
kernel/bpf/hashtab.c

index 7e848200cd268a0f9ed063f0b641d3c355787013..c1ac7f964bc997925fd427f5192168829d812e5d 100644 (file)
@@ -152,6 +152,7 @@ static void htab_init_buckets(struct bpf_htab *htab)
                        lockdep_set_class(&htab->buckets[i].lock,
                                          &htab->lockdep_key);
                }
+               cond_resched();
        }
 }