virtio-net: fix the set affinity bug when CPU IDs are not consecutive
authorWanlong Gao <gaowanlong@cn.fujitsu.com>
Thu, 24 Jan 2013 23:51:29 +0000 (23:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 27 Jan 2013 06:22:51 +0000 (01:22 -0500)
commit47be24796c13e7d9f087005c2bedc68ee0709f7b
treed1f4e4c652876e1121f97cb8f5ccf4e1ef1946bf
parentee50e135aeb048b90fab662e661c58b67341830b
virtio-net: fix the set affinity bug when CPU IDs are not consecutive

As Michael mentioned, set affinity and select queue will not work very
well when CPU IDs are not consecutive, this can happen with hot unplug.
Fix this bug by traversal the online CPUs, and create a per cpu variable
to find the mapping from CPU to the preferable virtual-queue.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Eric Dumazet <erdnetdev@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: virtualization@lists.linux-foundation.org
Cc: netdev@vger.kernel.org
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c