]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: hardcode BPF_PROG_PACK_SIZE to 2MB * num_possible_nodes()
authorPuranjay Mohan <puranjay12@gmail.com>
Mon, 11 Mar 2024 12:27:22 +0000 (12:27 +0000)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:19:41 +0000 (18:19 -0400)
commit535fb2160ade51d3b653b96575233ea46d1213a7
tree9fc2d7e65a98dfcfb01a3a2f03f1c25a234c3f00
parent408ba7fd04f959c61b50db79c983484312fea642
bpf: hardcode BPF_PROG_PACK_SIZE to 2MB * num_possible_nodes()

[ Upstream commit d6170e4aaf86424c24ce06e355b4573daa891b17 ]

On some architectures like ARM64, PMD_SIZE can be really large in some
configurations. Like with CONFIG_ARM64_64K_PAGES=y the PMD_SIZE is
512MB.

Use 2MB * num_possible_nodes() as the size for allocations done through
the prog pack allocator. On most architectures, PMD_SIZE will be equal
to 2MB in case of 4KB pages and will be greater than 2MB for bigger page
sizes.

Fixes: ea2babac63d4 ("bpf: Simplify bpf_prog_pack_[size|mask]")
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Closes: https://lore.kernel.org/all/7e216c88-77ee-47b8-becc-a0f780868d3c@sirena.org.uk/
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403092219.dhgcuz2G-lkp@intel.com/
Suggested-by: Song Liu <song@kernel.org>
Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
Message-ID: <20240311122722.86232-1-puranjay12@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/core.c