mbox series

[v2,0/3] crypto: allow users to specify acomp hardware from a desired NUMA node

Message ID 20200623041610.7620-1-song.bao.hua@hisilicon.com
Headers show
Series crypto: allow users to specify acomp hardware from a desired NUMA node | expand

Message

Song Bao Hua (Barry Song) June 23, 2020, 4:16 a.m. UTC
For a typical Linux server, probably there are several hardware modules.
For example, numa node0 has a compressor, numa node2 has a same module.
Some drivers are automatically using the module near the CPU calling
acomp_alloc.
But it isn't necessarily correct. Just like memory allocation API like
kmalloc and kmalloc_node. Similar optimization may be done for crypto.

-v2:
  * fix kern-doc and some codingstyle issues according to Jonathan's comment
  * patch 3/3 is rebased againest "[PATCH] mm/zswap: careful error path
    implementation in comp_prepare"[1]

[1] https://lkml.org/lkml/2020/6/22/347

Barry Song (3):
  crypto: permit users to specify numa node of acomp hardware
  crypto: hisilicon/zip - permit users to specify NUMA node
  mm/zswap: allocate acomp on the numa node committing acomp_req

 crypto/acompress.c                        |  8 ++++++++
 crypto/api.c                              | 22 ++++++++++++++--------
 crypto/internal.h                         | 23 +++++++++++++++++++----
 drivers/crypto/hisilicon/zip/zip.h        |  2 +-
 drivers/crypto/hisilicon/zip/zip_crypto.c |  6 +++---
 drivers/crypto/hisilicon/zip/zip_main.c   |  5 +++--
 include/crypto/acompress.h                | 18 ++++++++++++++++++
 include/linux/crypto.h                    |  2 ++
 mm/zswap.c                                |  2 +-
 9 files changed, 69 insertions(+), 19 deletions(-)

Comments

Herbert Xu July 3, 2020, 4:11 a.m. UTC | #1
On Tue, Jun 23, 2020 at 04:16:08PM +1200, Barry Song wrote:
>

> -void *crypto_create_tfm(struct crypto_alg *alg,

> -			const struct crypto_type *frontend)

> +void *crypto_create_tfm_node(struct crypto_alg *alg,

> +			const struct crypto_type *frontend,

> +			int node)

>  {

>  	char *mem;

>  	struct crypto_tfm *tfm = NULL;

> @@ -451,6 +452,7 @@ void *crypto_create_tfm(struct crypto_alg *alg,

>  

>  	tfm = (struct crypto_tfm *)(mem + tfmsize);

>  	tfm->__crt_alg = alg;

> +	tfm->node = node;


Should the kzalloc also use node?

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Song Bao Hua (Barry Song) July 3, 2020, 4:36 a.m. UTC | #2
> -----Original Message-----

> From: Herbert Xu [mailto:herbert@gondor.apana.org.au]

> Sent: Friday, July 3, 2020 4:11 PM

> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>

> Cc: davem@davemloft.net; Wangzhou (B) <wangzhou1@hisilicon.com>;

> Jonathan Cameron <jonathan.cameron@huawei.com>;

> akpm@linux-foundation.org; linux-crypto@vger.kernel.org;

> linux-mm@kvack.org; linux-kernel@vger.kernel.org; Linuxarm

> <linuxarm@huawei.com>; Seth Jennings <sjenning@redhat.com>; Dan

> Streetman <ddstreet@ieee.org>; Vitaly Wool <vitaly.wool@konsulko.com>

> Subject: Re: [PATCH v2 1/3] crypto: permit users to specify numa node of

> acomp hardware

> 

> On Tue, Jun 23, 2020 at 04:16:08PM +1200, Barry Song wrote:

> >

> > -void *crypto_create_tfm(struct crypto_alg *alg,

> > -			const struct crypto_type *frontend)

> > +void *crypto_create_tfm_node(struct crypto_alg *alg,

> > +			const struct crypto_type *frontend,

> > +			int node)

> >  {

> >  	char *mem;

> >  	struct crypto_tfm *tfm = NULL;

> > @@ -451,6 +452,7 @@ void *crypto_create_tfm(struct crypto_alg *alg,

> >

> >  	tfm = (struct crypto_tfm *)(mem + tfmsize);

> >  	tfm->__crt_alg = alg;

> > +	tfm->node = node;

> 

> Should the kzalloc also use node?


Yes, it would be nice since the tfm will mainly be accessed by CPU on the specific node.

> 

> Thanks,

> --

> Email: Herbert Xu <herbert@gondor.apana.org.au>

> Home Page: http://gondor.apana.org.au/~herbert/

> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Thanks
Barry