Messages in this thread Patch in this message | | | From | Guanjun He <> | Subject | [PATCH][mm:] adjust the logic of checking THP | Date | Tue, 1 Nov 2011 19:41:45 +0800 |
| |
Signed-off-by: Guanjun He <heguanbo@gmail.com> --- mm/memory.c | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c index a56e3ba..d6dd6b3 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3465,20 +3465,24 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, pmd = pmd_alloc(mm, pud, address); if (!pmd) return VM_FAULT_OOM; - if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) { - if (!vma->vm_ops) - return do_huge_pmd_anonymous_page(mm, vma, address, - pmd, flags); - } else { - pmd_t orig_pmd = *pmd; - barrier(); - if (pmd_trans_huge(orig_pmd)) { - if (flags & FAULT_FLAG_WRITE && - !pmd_write(orig_pmd) && - !pmd_trans_splitting(orig_pmd)) - return do_huge_pmd_wp_page(mm, vma, address, - pmd, orig_pmd); - return 0; + if (transparent_hugepage_enabled(vma)) { + if(pmd_none(*pmd)){ + if (!vma->vm_ops) + return do_huge_pmd_anonymous_page(mm, vma, address, + pmd, flags); + } + else + { + pmd_t orig_pmd = *pmd; + barrier(); + if (pmd_trans_huge(orig_pmd)) { + if (flags & FAULT_FLAG_WRITE && + !pmd_write(orig_pmd) && + !pmd_trans_splitting(orig_pmd)) + return do_huge_pmd_wp_page(mm, vma, address, + pmd, orig_pmd); + return 0; + } } } -- 1.7.7
| |