bpf, devmap: Use GFP_KERNEL for xdp bulk queue allocation
authorJun'ichi Nomura <junichi.nomura@nec.com>
Tue, 9 Feb 2021 08:24:52 +0000 (08:24 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:37:33 +0000 (11:37 +0100)
commite3c29af0658127075041c195b256f0e04828c72e
tree4c5f56c4c56e916d447a6d91eac5eca9724db32a
parent94c0e3551594011e6ffceca2c87196480010ef0b
bpf, devmap: Use GFP_KERNEL for xdp bulk queue allocation

[ Upstream commit 7d4553b69fb335496c597c31590e982485ebe071 ]

The devmap bulk queue is allocated with GFP_ATOMIC and the allocation
may fail if there is no available space in existing percpu pool.

Since commit 75ccae62cb8d42 ("xdp: Move devmap bulk queue into struct net_device")
moved the bulk queue allocation to NETDEV_REGISTER callback, whose context
is allowed to sleep, use GFP_KERNEL instead of GFP_ATOMIC to let percpu
allocator extend the pool when needed and avoid possible failure of netdev
registration.

As the required alignment is natural, we can simply use alloc_percpu().

Fixes: 75ccae62cb8d42 ("xdp: Move devmap bulk queue into struct net_device")
Signed-off-by: Jun'ichi Nomura <junichi.nomura@nec.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20210209082451.GA44021@jeru.linux.bs1.fc.nec.co.jp
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/devmap.c