From mboxrd@z Thu Jan 1 00:00:00 1970 From: Willem de Bruijn Subject: Re: [PATCH net-next] virtio_net: force_napi_tx module param. Date: Wed, 1 Aug 2018 11:56:14 -0400 Message-ID: References: <20180723231119.142904-1-caleb.raitto@gmail.com> <20180729.090027.1373538625446665385.davem@davemloft.net> <20180731153204-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: David Miller , caleb.raitto@gmail.com, Jason Wang , Network Development , Caleb Raitto To: "Michael S. Tsirkin" Return-path: Received: from mail-it0-f65.google.com ([209.85.214.65]:40819 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389682AbeHARnM (ORCPT ); Wed, 1 Aug 2018 13:43:12 -0400 Received: by mail-it0-f65.google.com with SMTP id h23-v6so9989196ita.5 for ; Wed, 01 Aug 2018 08:56:50 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: > > > > 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.