Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338726
b: refs/heads/master
c: fa475e5
h: refs/heads/master
v: v3
  • Loading branch information
Bob Liu authored and Linus Torvalds committed Dec 12, 2012
1 parent d981bd9 commit 54be521
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6219049ae1ce32b89236646cccaec2a5fc6c4fd2
refs/heads/master: fa475e517adb422cb3492e636195f9b2c0d009c8
38 changes: 17 additions & 21 deletions trunk/mm/huge_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,20 @@ static struct page
}
#endif

static bool hugepage_vma_check(struct vm_area_struct *vma)
{
if ((!(vma->vm_flags & VM_HUGEPAGE) && !khugepaged_always()) ||
(vma->vm_flags & VM_NOHUGEPAGE))
return false;

if (!vma->anon_vma || vma->vm_ops)
return false;
if (is_vma_temporary_stack(vma))
return false;
VM_BUG_ON(vma->vm_flags & VM_NO_THP);
return true;
}

static void collapse_huge_page(struct mm_struct *mm,
unsigned long address,
struct page **hpage,
Expand Down Expand Up @@ -1934,17 +1948,8 @@ static void collapse_huge_page(struct mm_struct *mm,
hend = vma->vm_end & HPAGE_PMD_MASK;
if (address < hstart || address + HPAGE_PMD_SIZE > hend)
goto out;

if ((!(vma->vm_flags & VM_HUGEPAGE) && !khugepaged_always()) ||
(vma->vm_flags & VM_NOHUGEPAGE))
goto out;

if (!vma->anon_vma || vma->vm_ops)
goto out;
if (is_vma_temporary_stack(vma))
if (!hugepage_vma_check(vma))
goto out;
VM_BUG_ON(vma->vm_flags & VM_NO_THP);

pmd = mm_find_pmd(mm, address);
if (!pmd)
goto out;
Expand Down Expand Up @@ -2152,20 +2157,11 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
progress++;
break;
}

if ((!(vma->vm_flags & VM_HUGEPAGE) &&
!khugepaged_always()) ||
(vma->vm_flags & VM_NOHUGEPAGE)) {
skip:
if (!hugepage_vma_check(vma)) {
skip:
progress++;
continue;
}
if (!vma->anon_vma || vma->vm_ops)
goto skip;
if (is_vma_temporary_stack(vma))
goto skip;
VM_BUG_ON(vma->vm_flags & VM_NO_THP);

hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
hend = vma->vm_end & HPAGE_PMD_MASK;
if (hstart >= hend)
Expand Down

0 comments on commit 54be521

Please sign in to comment.