Skip to content

Commit d87fdb1

Browse files
Fushuai Wangborkmann
authored andcommitted
bpf: Replace get_next_cpu() with cpumask_next_wrap()
The get_next_cpu() function was only used in one place to find the next possible CPU, which can be replaced by cpumask_next_wrap(). Signed-off-by: Fushuai Wang <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 1274163 commit d87fdb1

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

kernel/bpf/bpf_lru_list.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@
1919
#define LOCAL_PENDING_LIST_IDX LOCAL_LIST_IDX(BPF_LRU_LOCAL_LIST_T_PENDING)
2020
#define IS_LOCAL_LIST_TYPE(t) ((t) >= BPF_LOCAL_LIST_T_OFFSET)
2121

22-
static int get_next_cpu(int cpu)
23-
{
24-
cpu = cpumask_next(cpu, cpu_possible_mask);
25-
if (cpu >= nr_cpu_ids)
26-
cpu = cpumask_first(cpu_possible_mask);
27-
return cpu;
28-
}
29-
3022
/* Local list helpers */
3123
static struct list_head *local_free_list(struct bpf_lru_locallist *loc_l)
3224
{
@@ -482,7 +474,7 @@ static struct bpf_lru_node *bpf_common_lru_pop_free(struct bpf_lru *lru,
482474

483475
raw_spin_unlock_irqrestore(&steal_loc_l->lock, flags);
484476

485-
steal = get_next_cpu(steal);
477+
steal = cpumask_next_wrap(steal, cpu_possible_mask);
486478
} while (!node && steal != first_steal);
487479

488480
loc_l->next_steal = steal;

0 commit comments

Comments
 (0)