* [PATCH] net: Avoid allocing memory on memoryless numa node
@ 2020-10-11 4:11 Xianting Tian
2020-10-11 19:18 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Xianting Tian @ 2020-10-11 4:11 UTC (permalink / raw)
To: davem, kuba; +Cc: netdev, linux-kernel, Xianting Tian
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>
---
net/core/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 266073e30..dcb4533ef 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2590,7 +2590,7 @@ static struct xps_map *expand_xps_map(struct xps_map *map, int attr_index,
new_map = kzalloc(XPS_MAP_SIZE(alloc_len), GFP_KERNEL);
else
new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL,
- cpu_to_node(attr_index));
+ local_memory_node(cpu_to_node(attr_index)));
if (!new_map)
return NULL;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: Avoid allocing memory on memoryless numa node
2020-10-11 4:11 [PATCH] net: Avoid allocing memory on memoryless numa node Xianting Tian
@ 2020-10-11 19:18 ` Jakub Kicinski
2020-10-12 0:14 ` Tianxianting
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-10-11 19:18 UTC (permalink / raw)
To: Xianting Tian; +Cc: davem, netdev, linux-kernel
On Sun, 11 Oct 2020 12:11:40 +0800 Xianting Tian wrote:
> 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>
> ---
> net/core/dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 266073e30..dcb4533ef 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2590,7 +2590,7 @@ static struct xps_map *expand_xps_map(struct xps_map *map, int attr_index,
> new_map = kzalloc(XPS_MAP_SIZE(alloc_len), GFP_KERNEL);
> else
> new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL,
> - cpu_to_node(attr_index));
> + local_memory_node(cpu_to_node(attr_index)));
> if (!new_map)
> return NULL;
>
Are we going to patch all kmalloc_node() callers now to apply
local_memory_node()? Can't the allocator take care of this?
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] net: Avoid allocing memory on memoryless numa node
2020-10-11 19:18 ` Jakub Kicinski
@ 2020-10-12 0:14 ` Tianxianting
0 siblings, 0 replies; 3+ messages in thread
From: Tianxianting @ 2020-10-12 0:14 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, linux-kernel
Hi Jakub,
Thanks for your suggestion,
Let me try it :-)
-----Original Message-----
From: Jakub Kicinski [mailto:kuba@kernel.org]
Sent: Monday, October 12, 2020 3:18 AM
To: tianxianting (RD) <tian.xianting@h3c.com>
Cc: davem@davemloft.net; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: Avoid allocing memory on memoryless numa node
On Sun, 11 Oct 2020 12:11:40 +0800 Xianting Tian wrote:
> 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>
> ---
> net/core/dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c index
> 266073e30..dcb4533ef 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2590,7 +2590,7 @@ static struct xps_map *expand_xps_map(struct xps_map *map, int attr_index,
> new_map = kzalloc(XPS_MAP_SIZE(alloc_len), GFP_KERNEL);
> else
> new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL,
> - cpu_to_node(attr_index));
> + local_memory_node(cpu_to_node(attr_index)));
> if (!new_map)
> return NULL;
>
Are we going to patch all kmalloc_node() callers now to apply local_memory_node()? Can't the allocator take care of this?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-12 0:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-11 4:11 [PATCH] net: Avoid allocing memory on memoryless numa node Xianting Tian
2020-10-11 19:18 ` Jakub Kicinski
2020-10-12 0:14 ` Tianxianting
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).