Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-11 Thread Jason Wang
On 01/11/2013 03:12 AM, Ben Hutchings wrote: > On Thu, 2013-01-10 at 11:19 +1030, Rusty Russell wrote: >> Wanlong Gao writes: >>> On 01/09/2013 07:31 AM, Rusty Russell wrote: Wanlong Gao writes: > */ > static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff >

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-11 Thread Jason Wang
On 01/11/2013 03:12 AM, Ben Hutchings wrote: On Thu, 2013-01-10 at 11:19 +1030, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: On 01/09/2013 07:31 AM, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: */ static u16 virtnet_select_queue(struct

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-10 Thread Ben Hutchings
On Thu, 2013-01-10 at 11:19 +1030, Rusty Russell wrote: > Wanlong Gao writes: > > On 01/09/2013 07:31 AM, Rusty Russell wrote: > >> Wanlong Gao writes: > >>> */ > >>> static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff > >>> *skb) > >>> { > >>> - int txq =

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-10 Thread Wanlong Gao
On 01/10/2013 08:49 AM, Rusty Russell wrote: > Wanlong Gao writes: >> On 01/09/2013 07:31 AM, Rusty Russell wrote: >>> Wanlong Gao writes: */ static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) { - int txq = skb_rx_queue_recorded(skb) ?

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-10 Thread Ben Hutchings
On Thu, 2013-01-10 at 11:19 +1030, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: On 01/09/2013 07:31 AM, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: */ static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) { -

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-10 Thread Wanlong Gao
On 01/10/2013 08:49 AM, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: On 01/09/2013 07:31 AM, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: */ static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) { - int txq =

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-09 Thread Rusty Russell
Wanlong Gao writes: > On 01/09/2013 07:31 AM, Rusty Russell wrote: >> Wanlong Gao writes: >>> */ >>> static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff >>> *skb) >>> { >>> - int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : >>> -

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-09 Thread Rusty Russell
Wanlong Gao gaowanl...@cn.fujitsu.com writes: On 01/09/2013 07:31 AM, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: */ static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) { - int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) :

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Jason Wang
On 01/09/2013 09:52 AM, Wanlong Gao wrote: > On 01/08/2013 06:26 PM, Jason Wang wrote: >> On 01/08/2013 06:07 PM, Wanlong Gao wrote: >>> 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

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Wanlong Gao
On 01/09/2013 07:31 AM, Rusty Russell wrote: > Wanlong Gao writes: >> */ >> static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) >> { >> -int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : >> - smp_processor_id(); >> +int txq = 0; >> +

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Wanlong Gao
On 01/08/2013 06:26 PM, Jason Wang wrote: > On 01/08/2013 06:07 PM, Wanlong Gao wrote: >> 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

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Rusty Russell
Wanlong Gao writes: > */ > static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) > { > - int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : > - smp_processor_id(); > + int txq = 0; > + > + if (skb_rx_queue_recorded(skb)) > +

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Jason Wang
On 01/08/2013 06:07 PM, Wanlong Gao wrote: > 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

[PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Wanlong Gao
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

[PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Wanlong Gao
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

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Jason Wang
On 01/08/2013 06:07 PM, Wanlong Gao wrote: 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

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Rusty Russell
Wanlong Gao gaowanl...@cn.fujitsu.com writes: */ static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) { - int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : - smp_processor_id(); + int txq = 0; + + if

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Wanlong Gao
On 01/09/2013 07:31 AM, Rusty Russell wrote: Wanlong Gao gaowanl...@cn.fujitsu.com writes: */ static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) { -int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : - smp_processor_id(); +int

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Wanlong Gao
On 01/08/2013 06:26 PM, Jason Wang wrote: On 01/08/2013 06:07 PM, Wanlong Gao wrote: 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

Re: [PATCH V3 1/2] virtio-net: fix the set affinity bug when CPU IDs are not consecutive

2013-01-08 Thread Jason Wang
On 01/09/2013 09:52 AM, Wanlong Gao wrote: On 01/08/2013 06:26 PM, Jason Wang wrote: On 01/08/2013 06:07 PM, Wanlong Gao wrote: 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