* [PATCH bpf] bpf: add schedule point in htab_init_buckets()
@ 2020-12-21 19:25 Eric Dumazet
2020-12-21 20:54 ` Song Liu
2020-12-21 23:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2020-12-21 19:25 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: David S . Miller, netdev, Eric Dumazet, Eric Dumazet, bpf,
John Sperbeck, Song Liu
From: Eric Dumazet <edumazet@google.com>
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")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-By: John Sperbeck <jsperbeck@google.com>
Cc: Song Liu <songliubraving@fb.com>
---
kernel/bpf/hashtab.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
index 7e848200cd268a0f9ed063f0b641d3c355787013..c1ac7f964bc997925fd427f5192168829d812e5d 100644
--- a/kernel/bpf/hashtab.c
+++ b/kernel/bpf/hashtab.c
@@ -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();
}
}
--
2.29.2.729.g45daf8777d-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] bpf: add schedule point in htab_init_buckets()
2020-12-21 19:25 [PATCH bpf] bpf: add schedule point in htab_init_buckets() Eric Dumazet
@ 2020-12-21 20:54 ` Song Liu
2020-12-21 23:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2020-12-21 20:54 UTC (permalink / raw)
To: Eric Dumazet
Cc: Alexei Starovoitov, Daniel Borkmann, David S . Miller, netdev,
Eric Dumazet, bpf, John Sperbeck
> On Dec 21, 2020, at 11:25 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> From: Eric Dumazet <edumazet@google.com>
>
> 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")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-By: John Sperbeck <jsperbeck@google.com>
> Cc: Song Liu <songliubraving@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Thanks for the fix!
> ---
> kernel/bpf/hashtab.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> index 7e848200cd268a0f9ed063f0b641d3c355787013..c1ac7f964bc997925fd427f5192168829d812e5d 100644
> --- a/kernel/bpf/hashtab.c
> +++ b/kernel/bpf/hashtab.c
> @@ -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();
> }
> }
>
> --
> 2.29.2.729.g45daf8777d-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] bpf: add schedule point in htab_init_buckets()
2020-12-21 19:25 [PATCH bpf] bpf: add schedule point in htab_init_buckets() Eric Dumazet
2020-12-21 20:54 ` Song Liu
@ 2020-12-21 23:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-12-21 23:20 UTC (permalink / raw)
To: Eric Dumazet
Cc: ast, daniel, davem, netdev, edumazet, bpf, jsperbeck, songliubraving
Hello:
This patch was applied to bpf/bpf.git (refs/heads/master):
On Mon, 21 Dec 2020 11:25:06 -0800 you wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> 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.
>
> [...]
Here is the summary with links:
- [bpf] bpf: add schedule point in htab_init_buckets()
https://git.kernel.org/bpf/bpf/c/e7e518053c26
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-21 23:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 19:25 [PATCH bpf] bpf: add schedule point in htab_init_buckets() Eric Dumazet
2020-12-21 20:54 ` Song Liu
2020-12-21 23:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.