> > > > Just distribute across the available cpus evenly, and be done with it.
> > >
> > > Sounds good to me.
> >
> > So e.g. we could set an affinity hint to a group of CPUs that
> > might transmit to this queue.
>
> We also want to set the xps mask for all cpus in the group to this queue.
>
> Is there a benefit over explicitly choosing one cpu from the set, btw?
> I assumed striping. Something along the lines of
>
>   int stripe = max_t(int, num_online_cpus() / vi->curr_queue_pairs, 1);
>   int vq = 0;
>
>   cpumask_clear(xps_mask);
>
>   for_each_online_cpu(cpu) {
>       cpumask_set_cpu(cpu, xps_mask);
>
>       if ((i + 1) % stripe == 0) {
>           virtqueue_set_affinity(vi->rq[vq].vq, cpu);
>           virtqueue_set_affinity(vi->sq[vq].vq, cpu);
>           netif_set_xps_queue(vi->dev, xps_mask, vq);
>           cpumask_clear(xps_mask);
>           vq++;
>      }
>       i++;
>   }

.. but handling edge cases correctly, such as #cpu not being a perfect
multiple of #vq.

Reply via email to