Commit e7e51805 authored by Eric Dumazet's avatar Eric Dumazet Committed by Daniel Borkmann
Browse files

bpf: Add schedule point in htab_init_buckets()



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: c50eb518 ("bpf: Use separate lockdep class for each hashtab")
Reported-by: default avatarJohn Sperbeck <jsperbeck@google.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarSong Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20201221192506.707584-1-eric.dumazet@gmail.com
parent d467d80d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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();
	}
}