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 <[email protected]>
[
[email protected]: replaced #ifdef with VM_BUG_ON]
Signed-off-by: Catalin Marinas <[email protected]>
#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;