]> asedeno.scripts.mit.edu Git - linux.git/commit
crypto: scompress - defer allocation of scratch buffer to first use
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 21 Jul 2017 15:42:38 +0000 (16:42 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 3 Aug 2017 05:52:44 +0000 (13:52 +0800)
commit6a8487a1f29fa2801a530200c6cdf81592b1a4d7
tree306321a4b128678559257f2f26c819e791f35345
parentcc4d110ec824d3f05f95b1f705158afc6fb08773
crypto: scompress - defer allocation of scratch buffer to first use

The scompress code allocates 2 x 128 KB of scratch buffers for each CPU,
so that clients of the async API can use synchronous implementations
even from atomic context. However, on systems such as Cavium Thunderx
(which has 96 cores), this adds up to a non-negligible 24 MB. Also,
32-bit systems may prefer to use their precious vmalloc space for other
things,especially since there don't appear to be any clients for the
async compression API yet.

So let's defer allocation of the scratch buffers until the first time
we allocate an acompress cipher based on an scompress implementation.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/scompress.c