[PATCH RESEND 0/1] mm/zswap: move to use crypto_acomp APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Seth, Dan, Vitaly, Herbert, Andrew,

Using crypto_comp APIs, zswap is not able to use the hardware accelators which
are only ported to cryto_acomp nowadays. So Mahipal Challa tried to solve this
problem by the below patch a long time ago:
mm: zswap - Add crypto acomp/scomp framework support [1]

At that time, the test was based on acomp with scomp backend. It was not a real
async platform. On a platform with real acomp support like hisilicon-zip, the
patch will lead to serious "sleep on atomic" issues.

To leverage the power of hardware accelerator, right now, I am sending a new patch
which will remove the atomic context and permit crypto to sleep in zswap.

Literally, using an async compressor, people can dynamically allocate acomp_req and
multiple requests can queue in acomp drivers, and finally acomp drivers can use the
callback to notify the completion of compression/decompression. but this will require
dynamic memory allocation and various synchronizations in zswap, and it is too
complex.

Alternatively, this patch pre-allocates the acomp_req with the same number of CPUs.
For each acomp_req, one mutex and one wait are bound with it. The mutex is used
for the race protection of the acomp_req and other percpu resources. Even though
the preempt-disabled atomic context is replaced by sleepable context, threads
might migrate, but the mutex can still protect the race between CPUs for same
resources.

Tested on hisilicon zip driver on a SMP enviorment and on lz4 scomp-based acomp
as well. To use scomp-based acomp, another patch I sent before is needed:
crypto: acomp - search acomp with scomp backend in crypto_has_acomp [2]

[1] https://www.spinics.net/lists/linux-mm/msg122455.html
[2] https://marc.info/?l=linux-crypto-vger&m=158822346227760&w=2

Barry Song (1):
  mm/zswap: move to use crypto_acomp API for hardware acceleration

 mm/zswap.c | 150 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 108 insertions(+), 42 deletions(-)

-- 
2.23.0





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux