diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-05-12 03:36:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-12 03:36:18 -0400 |
commit | 9cb5baba5e3acba0994ad899ee908799104c9965 (patch) | |
tree | d5ff16000256a0bf56279926e6114b4603ede2b4 /mm/huge_memory.c | |
parent | 7142d17e8f935fa842e9f6eece2281b6d41625d6 (diff) | |
parent | 693d92a1bbc9e42681c42ed190bd42b636ca876f (diff) |
Merge commit 'v2.6.39-rc7' into sched/core
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r-- | mm/huge_memory.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 470dcda10add..83326ad66d9b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1408,6 +1408,9 @@ out: | |||
1408 | return ret; | 1408 | return ret; |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | #define VM_NO_THP (VM_SPECIAL|VM_INSERTPAGE|VM_MIXEDMAP|VM_SAO| \ | ||
1412 | VM_HUGETLB|VM_SHARED|VM_MAYSHARE) | ||
1413 | |||
1411 | int hugepage_madvise(struct vm_area_struct *vma, | 1414 | int hugepage_madvise(struct vm_area_struct *vma, |
1412 | unsigned long *vm_flags, int advice) | 1415 | unsigned long *vm_flags, int advice) |
1413 | { | 1416 | { |
@@ -1416,11 +1419,7 @@ int hugepage_madvise(struct vm_area_struct *vma, | |||
1416 | /* | 1419 | /* |
1417 | * Be somewhat over-protective like KSM for now! | 1420 | * Be somewhat over-protective like KSM for now! |
1418 | */ | 1421 | */ |
1419 | if (*vm_flags & (VM_HUGEPAGE | | 1422 | if (*vm_flags & (VM_HUGEPAGE | VM_NO_THP)) |
1420 | VM_SHARED | VM_MAYSHARE | | ||
1421 | VM_PFNMAP | VM_IO | VM_DONTEXPAND | | ||
1422 | VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE | | ||
1423 | VM_MIXEDMAP | VM_SAO)) | ||
1424 | return -EINVAL; | 1423 | return -EINVAL; |
1425 | *vm_flags &= ~VM_NOHUGEPAGE; | 1424 | *vm_flags &= ~VM_NOHUGEPAGE; |
1426 | *vm_flags |= VM_HUGEPAGE; | 1425 | *vm_flags |= VM_HUGEPAGE; |
@@ -1436,11 +1435,7 @@ int hugepage_madvise(struct vm_area_struct *vma, | |||
1436 | /* | 1435 | /* |
1437 | * Be somewhat over-protective like KSM for now! | 1436 | * Be somewhat over-protective like KSM for now! |
1438 | */ | 1437 | */ |
1439 | if (*vm_flags & (VM_NOHUGEPAGE | | 1438 | if (*vm_flags & (VM_NOHUGEPAGE | VM_NO_THP)) |
1440 | VM_SHARED | VM_MAYSHARE | | ||
1441 | VM_PFNMAP | VM_IO | VM_DONTEXPAND | | ||
1442 | VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE | | ||
1443 | VM_MIXEDMAP | VM_SAO)) | ||
1444 | return -EINVAL; | 1439 | return -EINVAL; |
1445 | *vm_flags &= ~VM_HUGEPAGE; | 1440 | *vm_flags &= ~VM_HUGEPAGE; |
1446 | *vm_flags |= VM_NOHUGEPAGE; | 1441 | *vm_flags |= VM_NOHUGEPAGE; |
@@ -1574,10 +1569,14 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | |||
1574 | * page fault if needed. | 1569 | * page fault if needed. |
1575 | */ | 1570 | */ |
1576 | return 0; | 1571 | return 0; |
1577 | if (vma->vm_file || vma->vm_ops) | 1572 | if (vma->vm_ops) |
1578 | /* khugepaged not yet working on file or special mappings */ | 1573 | /* khugepaged not yet working on file or special mappings */ |
1579 | return 0; | 1574 | return 0; |
1580 | VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma)); | 1575 | /* |
1576 | * If is_pfn_mapping() is true is_learn_pfn_mapping() must be | ||
1577 | * true too, verify it here. | ||
1578 | */ | ||
1579 | VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP); | ||
1581 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; | 1580 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; |
1582 | hend = vma->vm_end & HPAGE_PMD_MASK; | 1581 | hend = vma->vm_end & HPAGE_PMD_MASK; |
1583 | if (hstart < hend) | 1582 | if (hstart < hend) |
@@ -1828,12 +1827,15 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
1828 | (vma->vm_flags & VM_NOHUGEPAGE)) | 1827 | (vma->vm_flags & VM_NOHUGEPAGE)) |
1829 | goto out; | 1828 | goto out; |
1830 | 1829 | ||
1831 | /* VM_PFNMAP vmas may have vm_ops null but vm_file set */ | 1830 | if (!vma->anon_vma || vma->vm_ops) |
1832 | if (!vma->anon_vma || vma->vm_ops || vma->vm_file) | ||
1833 | goto out; | 1831 | goto out; |
1834 | if (is_vma_temporary_stack(vma)) | 1832 | if (is_vma_temporary_stack(vma)) |
1835 | goto out; | 1833 | goto out; |
1836 | VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma)); | 1834 | /* |
1835 | * If is_pfn_mapping() is true is_learn_pfn_mapping() must be | ||
1836 | * true too, verify it here. | ||
1837 | */ | ||
1838 | VM_BUG_ON(is_linear_pfn_mapping(vma) || vma->vm_flags & VM_NO_THP); | ||
1837 | 1839 | ||
1838 | pgd = pgd_offset(mm, address); | 1840 | pgd = pgd_offset(mm, address); |
1839 | if (!pgd_present(*pgd)) | 1841 | if (!pgd_present(*pgd)) |
@@ -2066,13 +2068,16 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, | |||
2066 | progress++; | 2068 | progress++; |
2067 | continue; | 2069 | continue; |
2068 | } | 2070 | } |
2069 | /* VM_PFNMAP vmas may have vm_ops null but vm_file set */ | 2071 | if (!vma->anon_vma || vma->vm_ops) |
2070 | if (!vma->anon_vma || vma->vm_ops || vma->vm_file) | ||
2071 | goto skip; | 2072 | goto skip; |
2072 | if (is_vma_temporary_stack(vma)) | 2073 | if (is_vma_temporary_stack(vma)) |
2073 | goto skip; | 2074 | goto skip; |
2074 | 2075 | /* | |
2075 | VM_BUG_ON(is_linear_pfn_mapping(vma) || is_pfn_mapping(vma)); | 2076 | * If is_pfn_mapping() is true is_learn_pfn_mapping() |
2077 | * must be true too, verify it here. | ||
2078 | */ | ||
2079 | VM_BUG_ON(is_linear_pfn_mapping(vma) || | ||
2080 | vma->vm_flags & VM_NO_THP); | ||
2076 | 2081 | ||
2077 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; | 2082 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; |
2078 | hend = vma->vm_end & HPAGE_PMD_MASK; | 2083 | hend = vma->vm_end & HPAGE_PMD_MASK; |