summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnshuman Khandual <anshuman.khandual@arm.com>2020-04-06 20:03:59 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-04-07 10:43:38 -0700
commit5093c5872be3a041917828b2b53e9f981d754768 (patch)
treec2a9aad0d1cbe3d9304d67b64aba59a2d0e3f463 /arch
parenta0137f16dfe870d63bfb9acdc34b67745270ab4b (diff)
downloadlinux-5093c5872be3a041917828b2b53e9f981d754768.tar.bz2
mm/vma: append unlikely() while testing VMA access permissions
It is unlikely that an inaccessible VMA without required permission flags will get a page fault. Hence lets just append unlikely() directive to such checks in order to improve performance while also standardizing it across various platforms. Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Guo Ren <guoren@kernel.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul Burton <paulburton@kernel.org> Cc: Mike Rapoport <rppt@linux.ibm.com> Link: http://lkml.kernel.org/r/1582525304-32113-1-git-send-email-anshuman.khandual@arm.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/csky/mm/fault.c2
-rw-r--r--arch/m68k/mm/fault.c2
-rw-r--r--arch/mips/mm/fault.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/arch/csky/mm/fault.c b/arch/csky/mm/fault.c
index a6e8230b6fbf..4e6dc68f3258 100644
--- a/arch/csky/mm/fault.c
+++ b/arch/csky/mm/fault.c
@@ -141,7 +141,7 @@ good_area:
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;
} else {
- if (!vma_is_accessible(vma))
+ if (unlikely(!vma_is_accessible(vma)))
goto bad_area;
}
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index 0c4a21a685d5..3bfb5c8ac3c7 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -125,7 +125,7 @@ good_area:
case 1: /* read, present */
goto acc_err;
case 0: /* read, not present */
- if (!vma_is_accessible(vma))
+ if (unlikely(!vma_is_accessible(vma)))
goto acc_err;
}
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index fb048ba2b91d..f8d62cd83b36 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -142,7 +142,7 @@ good_area:
goto bad_area;
}
} else {
- if (!vma_is_accessible(vma))
+ if (unlikely(!vma_is_accessible(vma)))
goto bad_area;
}
}