Skip to content

Commit

Permalink
Merge branch 'hv_netvsc-next'
Browse files Browse the repository at this point in the history
K. Y. Srinivasan says:

====================
hv_netvsc: Implement NUMA aware memory allocation

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

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 31, 2015
2 parents 282c320 + 5defde5 commit d1f5f2b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/net/hyperv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -321,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);
Expand Down

0 comments on commit d1f5f2b

Please sign in to comment.