KASAN overhead?

From: Valdis Kletnieks
Date: Fri Mar 18 2016 - 16:41:49 EST


So I built linux-next next-20160417 with KASAN enabled:

CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000
CONFIG_HAVE_ARCH_KASAN=y
CONFIG_KASAN=y
# CONFIG_KASAN_OUTLINE is not set
CONFIG_KASAN_INLINE=y
CONFIG_TEST_KASAN=m

and saw an *amazing* slowdown. For comparison, here is the time taken
to reach various points in the dmesg:

% grep -i free dmesg.0317*
dmesg.0317:[ 1.560907] Freeing SMP alternatives memory: 28K (ffffffff93d3e000 - ffffffff93d45000)
dmesg.0317:[ 12.041550] Freeing initrd memory: 10432K (ffff88003f5cb000 - ffff88003fffb000)
dmesg.0317:[ 16.458451] ata1.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out
dmesg.0317:[ 16.545603] ata1.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out
dmesg.0317:[ 17.818934] Freeing unused kernel memory: 1628K (ffffffff93ba7000 - ffffffff93d3e000)
dmesg.0317:[ 17.820234] Freeing unused kernel memory: 1584K (ffff880012c74000 - ffff880012e00000)
dmesg.0317:[ 17.828426] Freeing unused kernel memory: 1524K (ffff880013483000 - ffff880013600000)
dmesg.0317-nokasan:[ 0.028821] Freeing SMP alternatives memory: 28K (ffffffffaf104000 - ffffffffaf10b000)
dmesg.0317-nokasan:[ 1.587232] Freeing initrd memory: 10432K (ffff88003f5cb000 - ffff88003fffb000)
dmesg.0317-nokasan:[ 2.433557] ata1.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out
dmesg.0317-nokasan:[ 2.439411] ata1.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out
dmesg.0317-nokasan:[ 2.488113] Freeing unused kernel memory: 1324K (ffffffffaefb9000 - ffffffffaf104000)
dmesg.0317-nokasan:[ 2.488518] Freeing unused kernel memory: 88K (ffff88002e9ea000 - ffff88002ea00000)
dmesg.0317-nokasan:[ 2.489490] Freeing unused kernel memory: 388K (ffff88002ed9f000 - ffff88002ee00000)

Only config difference was changing to CONFIG_KASAN=n.

Is this level of slowdown expected? Or is my kernel unexpectedly off in the weeds?

Attachment: pgpsvCA3xx73q.pgp
Description: PGP signature