Re: [PATCH bpf-next] selftests/bpf: Harden cpu flags test for lru_percpu_hash map

From: Martin KaFai Lau

Date: Mon Jan 26 2026 - 15:39:40 EST


On 1/19/26 5:34 AM, Leon Hwang wrote:
Harden the test against this behavior by provisioning sufficient spare
elements. Set max_entries to 'nr_cpus * 2' and restrict the test to using
the first nr_cpus entries, ensuring that updates do not spuriously trigger
LRU eviction.

[ ... ]

@ -300,7 +307,7 @@ static void test_percpu_map_cpu_flag(enum bpf_map_type map_type)
if (!ASSERT_GT(nr_cpus, 0, "libbpf_num_possible_cpus"))
return;
- max_entries = nr_cpus + 1;
+ max_entries = nr_cpus * 2;
keys = calloc(max_entries, key_sz);

Does it need to allocate "nr_cpus * 2" number of keys while only first nr_cpus entries are used? This can be a followup if it's needed. Applied to start getting signal from CI.