Skip to contentSkip to conversation

hv_netvsc: Implement NUMA aware memory allocation

PATCH In review K. Y. Srinivasan 2 participants 4 messages May 28, 2015 – May 31, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover hv_netvsc: Implement NUMA aware memory allocation

Allocate both receive buffer and send buffer from the NUMA node assigned to the primary channel.

K. Y. Srinivasan (2):
hv_netvsc: Allocate the receive buffer from the correct NUMA node
hv_netvsc: Allocate the sendbuf in a NUMA aware way

 drivers/net/hyperv/netvsc.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v2 1/2 hv_netvsc: Allocate the receive buffer from the correct NUMA node

Allocate the receive bufer from the NUMA node assigned to the primary channel.

---
V2: Specify the tree for this patch.

 drivers/net/hyperv/netvsc.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/hyperv/netvsc.c +6 -1
index b024968..d187965 100644
@@ -227,13 +227,18 @@ static int netvsc_init_buf(struct hv_device *device)
 	struct netvsc_device *net_device;
 	struct nvsp_message *init_packet;
 	struct net_device *ndev;
+	int node;
 
 	net_device = get_outbound_net_device(device);
 	if (!net_device)
 		return -ENODEV;
 	ndev = net_device->ndev;
 
-	net_device->recv_buf = vzalloc(net_device->recv_buf_size);
+	node = cpu_to_node(device->channel->target_cpu);
+	net_device->recv_buf = vzalloc_node(net_device->recv_buf_size, node);
+	if (!net_device->recv_buf)
+		net_device->recv_buf = vzalloc(net_device->recv_buf_size);
+
 	if (!net_device->recv_buf) {
 		netdev_err(ndev, "unable to allocate receive "
 			"buffer of size %d\n", net_device->recv_buf_size);
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/2 hv_netvsc: Allocate the sendbuf in a NUMA aware way

Allocate the send buffer in a NUMA aware way.

---
 drivers/net/hyperv/netvsc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/net/hyperv/netvsc.c +3 -1
index d187965..06de98a 100644
@@ -326,7 +326,9 @@ static int netvsc_init_buf(struct hv_device *device)
 
 	/* Now setup the send buffer.
 	 */
-	net_device->send_buf = vzalloc(net_device->send_buf_size);
+	net_device->send_buf = vzalloc_node(net_device->send_buf_size, node);
+	if (!net_device->send_buf)
+		net_device->send_buf = vzalloc(net_device->send_buf_size);
 	if (!net_device->send_buf) {
 		netdev_err(ndev, "unable to allocate send "
 			   "buffer of size %d\n", net_device->send_buf_size);
Signature · 1 line
1.7.4.1