Skip to content

Commit

Permalink
bpf: Avoid allocing memory on memoryless numa node
Browse files Browse the repository at this point in the history
In architecture like powerpc, we can have cpus without any local memory
attached to it. In such cases the node does not have real memory.

Use local_memory_node(), which is guaranteed to have memory.
local_memory_node is a noop in other architectures that does not support
memoryless nodes.

Signed-off-by: Xianting Tian <tian.xianting@h3c.com>
  • Loading branch information
Xianting Tian authored and kernel-patches-bot committed Oct 11, 2020
1 parent 94b6ad5 commit adf143f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/bpf/cpumap.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ __cpu_map_entry_alloc(struct bpf_cpumap_val *value, u32 cpu, int map_id)
struct xdp_bulk_queue *bq;

/* Have map->numa_node, but choose node of redirect target CPU */
numa = cpu_to_node(cpu);
numa = local_memory_node(cpu_to_node(cpu));

rcpu = kzalloc_node(sizeof(*rcpu), gfp, numa);
if (!rcpu)
Expand Down

0 comments on commit adf143f

Please sign in to comment.