zswap: Defer zswap initialisation
authorPhil Elwell <phil@raspberrypi.com>
Tue, 5 May 2020 14:23:32 +0000 (15:23 +0100)
committerpopcornmix <popcornmix@gmail.com>
Wed, 27 Jan 2021 19:13:11 +0000 (19:13 +0000)
commita6467ccdec7862d20e97dd63c8d4047b7a9dd8c2
treecdc214c9e0ff8dcc8da0372095921684dbd50a58
parent6dfeeea6162cd809f23947dbe16966524af8dc5e
zswap: Defer zswap initialisation

Enabling zswap support in the kernel configuration costs about 1.5MB
of RAM, even when zswap is not enabled at runtime. This cost can be
reduced significantly by deferring initialisation (including pool
creation) until the "enabled" parameter is set to true. There is a
small cost to this in that some initialisation code has to remain in
memory after the init phase, just in case they are needed later,
but the total size increase is negligible.

See: https://github.com/raspberrypi/linux/pull/3432

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
mm/zswap.c