linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: Hillf Danton <hdanton@sina.com>
Cc: herbert@gondor.apana.org.au, fenghua.yu@intel.com,
	vkoul@kernel.org, linux-kernel@vger.kernel.org,
	linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v2 10/15] crypto: iaa - Add per-cpu workqueue table with rebalancing
Date: Wed, 29 Mar 2023 09:58:48 -0500	[thread overview]
Message-ID: <e208af4cc343901ac5d9a0e5b4f21923623b266f.camel@linux.intel.com> (raw)
In-Reply-To: <20230329075149.2736-1-hdanton@sina.com>

Hi Hillf,

On Wed, 2023-03-29 at 15:51 +0800, Hillf Danton wrote:
> On 28 Mar 2023 10:35:30 -0500 Tom Zanussi
> <tom.zanussi@linux.intel.com>
> > +/*
> > + * Given a cpu, find the closest IAA instance.  The idea is to try
> > to
> > + * choose the most appropriate IAA instance for a caller and
> > spread
> > + * available workqueues around to clients.
> > + */
> > +static inline int cpu_to_iaa(int cpu)
> > +{
> > +       int node, n_cpus = 0, test_cpu, iaa = 0;
> > +       int nr_iaa_per_node, nr_cores_per_iaa;
> > +       const struct cpumask *node_cpus;
> > +
> > +       if (!nr_nodes)
> > +               return 0;
> > +
> > +       nr_iaa_per_node = nr_iaa / nr_nodes;
> > +       if (!nr_iaa_per_node)
> > +               return 0;
> > +
> > +       nr_cores_per_iaa = nr_cpus_per_node / nr_iaa_per_node;
> > +
> > +       for_each_online_node(node) {
> > +               node_cpus = cpumask_of_node(node);
> > +               if (!cpumask_test_cpu(cpu, node_cpus))
> > +                       continue;
> 
> cpu_to_node(cpu) works for you.

Yes, thanks for pointing that out.

> > +
> > +               for_each_cpu(test_cpu, node_cpus) {
> > +                       if ((n_cpus % nr_cpus_per_node) == 0)
> > +                               iaa = node * nr_iaa_per_node;
> > +
> > +                       if (test_cpu == cpu)
> > +                               return iaa;
> 
> Given nr_iaa_per_node, why round robin-ing every iaa in the node not
> work?

True, we should be able to simplify this, will do for the next version.

Thanks,

Tom


> > +
> > +                       n_cpus++;
> > +
> > +                       if ((n_cpus % cpus_per_iaa) == 0)
> > +                               iaa++;
> > +               }
> > +       }
> > +
> > +       return -1;
> > +}


      parent reply	other threads:[~2023-03-29 14:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 15:35 [PATCH v2 00/15] crypto: Add Intel Analytics Accelerator (IAA) crypto compression driver Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 01/15] dmaengine: idxd: add wq driver name support for accel-config user tool Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 02/15] dmaengine: idxd: add external module driver support for dsa_bus_type Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 03/15] dmaengine: idxd: Export drv_enable/disable and related functions Tom Zanussi
2023-03-28 16:02   ` Dave Jiang
2023-03-28 15:35 ` [PATCH v2 04/15] dmaengine: idxd: Export descriptor management functions Tom Zanussi
2023-03-28 16:04   ` Dave Jiang
2023-03-28 16:12     ` Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 05/15] dmaengine: idxd: Export wq resource " Tom Zanussi
2023-03-28 16:04   ` Dave Jiang
2023-03-28 15:35 ` [PATCH v2 06/15] dmaengine: idxd: Add private_data to struct idxd_wq Tom Zanussi
2023-03-28 16:06   ` Dave Jiang
2023-03-28 16:13     ` Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 07/15] dmaengine: idxd: add callback support for iaa crypto Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 08/15] crypto: iaa - Add IAA Compression Accelerator Documentation Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 09/15] crypto: iaa - Add Intel IAA Compression Accelerator crypto driver core Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 10/15] crypto: iaa - Add per-cpu workqueue table with rebalancing Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 11/15] crypto: iaa - Add compression mode management along with fixed mode Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 12/15] crypto: iaa - Add support for iaa_crypto deflate compression algorithm Tom Zanussi
2023-04-06  8:00   ` Herbert Xu
2023-04-06 14:43     ` Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 13/15] crypto: iaa - Add support for default IAA 'canned' compression mode Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 14/15] crypto: iaa - Add irq support for the crypto async interface Tom Zanussi
2023-03-28 15:35 ` [PATCH v2 15/15] crypto: iaa - Add IAA Compression Accelerator stats Tom Zanussi
     [not found] ` <20230329075149.2736-1-hdanton@sina.com>
2023-03-29 14:58   ` Tom Zanussi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e208af4cc343901ac5d9a0e5b4f21923623b266f.camel@linux.intel.com \
    --to=tom.zanussi@linux.intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=fenghua.yu@intel.com \
    --cc=hdanton@sina.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).