[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 10 Oct 2020 16:44:17 +0800
From: Xianting Tian <tian.xianting@....com>
To: <ast@...nel.org>, <daniel@...earbox.net>, <davem@...emloft.net>,
<kuba@...nel.org>, <hawk@...nel.org>, <john.fastabend@...il.com>,
<kafai@...com>, <songliubraving@...com>, <yhs@...com>,
<andriin@...com>, <kpsingh@...omium.org>
CC: <netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Xianting Tian <tian.xianting@....com>
Subject: [PATCH] bpf: Avoid allocing memory on memoryless numa node
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@....com>
---
kernel/bpf/cpumap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
index 6386b7bb9..2c885c00a 100644
--- a/kernel/bpf/cpumap.c
+++ b/kernel/bpf/cpumap.c
@@ -423,7 +423,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)
--
2.17.1
Powered by blists - more mailing lists