Message ID | 20200807091251.12129-7-richard.weiyang@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm/hugetlb: code refine and simplification | expand |
On 08/07/20 at 05:12pm, Wei Yang wrote: > Before proper processing, huge_pte_alloc() would be called > un-conditionally. It is not necessary to do this when ptep is NULL. > > Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com> > --- > mm/hugetlb.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index f5f04e89000d..fb09e5a83c39 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -4534,10 +4534,6 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, > } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) > return VM_FAULT_HWPOISON_LARGE | > VM_FAULT_SET_HINDEX(hstate_index(h)); > - } else { > - ptep = huge_pte_alloc(mm, haddr, huge_page_size(h)); > - if (!ptep) > - return VM_FAULT_OOM; Right, seems a relic from Mike's i_mmap_rwsem handling patches. Reviewed-by: Baoquan He <bhe@redhat.com> > } > > /* > -- > 2.20.1 (Apple Git-117) > >
On 8/7/20 2:12 AM, Wei Yang wrote: > Before proper processing, huge_pte_alloc() would be called > un-conditionally. It is not necessary to do this when ptep is NULL. Worse, that extra call is a bug. I believe Andrew pulled this patch into his queue. It still could use a review. https://lore.kernel.org/linux-mm/e670f327-5cf9-1959-96e4-6dc7cc30d3d5@oracle.com/
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f5f04e89000d..fb09e5a83c39 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4534,10 +4534,6 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry))) return VM_FAULT_HWPOISON_LARGE | VM_FAULT_SET_HINDEX(hstate_index(h)); - } else { - ptep = huge_pte_alloc(mm, haddr, huge_page_size(h)); - if (!ptep) - return VM_FAULT_OOM; } /*
Before proper processing, huge_pte_alloc() would be called un-conditionally. It is not necessary to do this when ptep is NULL. Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com> --- mm/hugetlb.c | 4 ---- 1 file changed, 4 deletions(-)