diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2019-03-29 14:09:56 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-04-08 14:36:16 +0800 |
commit | 6d20adda638c1fdef150bb9f7ac2cd11010e15fe (patch) | |
tree | 980560a1cf98c0ca2e1a055029683cad1fffd60d /crypto/skcipher.c | |
parent | a2e9cc3199518db7b7fa5af83d4e215ab474bbb7 (diff) | |
download | linux-crypto-6d20adda638c1fdef150bb9f7ac2cd11010e15fe.tar.gz linux-crypto-6d20adda638c1fdef150bb9f7ac2cd11010e15fe.zip |
crypto: scompress - Use per-CPU struct instead multiple variables
Two per-CPU variables are allocated as pointer to per-CPU memory which
then are used as scratch buffers.
We could be smart about this and use instead a per-CPU struct which
contains the pointers already and then we need to allocate just the
scratch buffers.
Add a lock to the struct. By doing so we can avoid the get_cpu()
statement and gain lockdep coverage (if enabled) to ensure that the lock
is always acquired in the right context. On non-preemptible kernels the
lock vanishes.
It is okay to use raw_cpu_ptr() in order to get a pointer to the struct
since it is protected by the spinlock.
The diffstat of this is negative and according to size scompress.o:
text data bss dec hex filename
1847 160 24 2031 7ef dbg_before.o
1754 232 4 1990 7c6 dbg_after.o
1799 64 24 1887 75f no_dbg-before.o
1703 88 4 1795 703 no_dbg-after.o
The overall size increase difference is also negative. The increase in
the data section is only four bytes without lockdep.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/skcipher.c')
0 files changed, 0 insertions, 0 deletions