[PATCH 01/10] mm: pagewalk: consolidate vma->vm_start checks

From: Dave Hansen
Date: Mon Jun 02 2014 - 17:42:03 EST



From: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>

We check vma->vm_start against the address being walked twice.
Consolidate the locations down to a single one.

Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
---

b/mm/pagewalk.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff -puN mm/pagewalk.c~pagewalk-always-skip-hugetlbfs-except-when-explicitly-handled mm/pagewalk.c
--- a/mm/pagewalk.c~pagewalk-always-skip-hugetlbfs-except-when-explicitly-handled 2014-06-02 14:20:18.938791410 -0700
+++ b/mm/pagewalk.c 2014-06-02 14:20:18.941791545 -0700
@@ -192,13 +192,12 @@ int walk_page_range(unsigned long addr,
* - VM_PFNMAP vma's
*/
vma = find_vma(walk->mm, addr);
- if (vma) {
+ if (vma && (vma->vm_start <= addr)) {
/*
* There are no page structures backing a VM_PFNMAP
* range, so do not allow split_huge_page_pmd().
*/
- if ((vma->vm_start <= addr) &&
- (vma->vm_flags & VM_PFNMAP)) {
+ if (vma->vm_flags & VM_PFNMAP) {
next = vma->vm_end;
pgd = pgd_offset(walk->mm, next);
continue;
@@ -209,8 +208,7 @@ int walk_page_range(unsigned long addr,
* architecture and we can't handled it in the same
* manner as non-huge pages.
*/
- if (walk->hugetlb_entry && (vma->vm_start <= addr) &&
- is_vm_hugetlb_page(vma)) {
+ if (walk->hugetlb_entry && is_vm_hugetlb_page(vma)) {
if (vma->vm_end < next)
next = vma->vm_end;
/*
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/