lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <e208af4cc343901ac5d9a0e5b4f21923623b266f.camel@linux.intel.com>
Date:   Wed, 29 Mar 2023 09:58:48 -0500
From:   Tom Zanussi <tom.zanussi@...ux.intel.com>
To:     Hillf Danton <hdanton@...a.com>
Cc:     herbert@...dor.apana.org.au, fenghua.yu@...el.com,
        vkoul@...nel.org, linux-kernel@...r.kernel.org,
        linux-crypto@...r.kernel.org, dmaengine@...r.kernel.org
Subject: Re: [PATCH v2 10/15] crypto: iaa - Add per-cpu workqueue table with
 rebalancing

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@...ux.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;
> > +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ