arm64: mm: only perform memstart_addr sanity check if DEBUG_VM
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 22 Feb 2016 17:46:03 +0000 (18:46 +0100)
committerAlex Shi <alex.shi@linaro.org>
Wed, 11 May 2016 14:52:49 +0000 (22:52 +0800)
Checking whether memstart_addr has been assigned every time it is
referenced adds a branch instruction that may hurt performance if
the reference in question occurs on a hot path. So only perform the
check if CONFIG_DEBUG_VM=y.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
[catalin.marinas@arm.com: replaced #ifdef with VM_BUG_ON]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit a92405f082d43267575444a6927085e4c8a69e4e)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
arch/arm64/include/asm/memory.h

index 3239e4d78e0d4d40fc7acaf1ff0018b675dfb6b0..460d09bf94424c45b40a5a486ac4b3b93ef0fdd5 100644 (file)
 
 #ifndef __ASSEMBLY__
 
+#include <linux/mmdebug.h>
+
 extern phys_addr_t             memstart_addr;
 /* PHYS_OFFSET - the physical address of the start of memory. */
-#define PHYS_OFFSET            ({ BUG_ON(memstart_addr & 1); memstart_addr; })
+#define PHYS_OFFSET            ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; })
 
 /* the offset between the kernel virtual and physical mappings */
 extern u64                     kimage_voffset;