On Fri, Mar 15, 2013 at 1:50 AM, Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> wrote: > From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> > > It's confusing that mk_huge_pmd() has sematics different from mk_pte() > or mk_pmd(). > > Let's move maybe_pmd_mkwrite() out of mk_huge_pmd() and adjust > prototype to match mk_pte(). > No urgent if not used subsequently. > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> > --- > mm/huge_memory.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 34e0385..be7b7e1 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -691,11 +691,10 @@ pmd_t maybe_pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma) > return pmd; > } > > -static inline pmd_t mk_huge_pmd(struct page *page, struct vm_area_struct *vma) > +static inline pmd_t mk_huge_pmd(struct page *page, pgprot_t prot) > { > pmd_t entry; > - entry = mk_pmd(page, vma->vm_page_prot); > - entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); > + entry = mk_pmd(page, prot); > entry = pmd_mkhuge(entry); > return entry; > } > @@ -723,7 +722,8 @@ static int __do_huge_pmd_anonymous_page(struct mm_struct *mm, > pte_free(mm, pgtable); > } else { > pmd_t entry; > - entry = mk_huge_pmd(page, vma); > + entry = mk_huge_pmd(page, vma->vm_page_prot); > + entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); > /* > * The spinlocking to take the lru_lock inside > * page_add_new_anon_rmap() acts as a full memory > @@ -1212,7 +1212,8 @@ alloc: > goto out_mn; > } else { > pmd_t entry; > - entry = mk_huge_pmd(new_page, vma); > + entry = mk_huge_pmd(new_page, vma->vm_page_prot); > + entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); > pmdp_clear_flush(vma, haddr, pmd); > page_add_new_anon_rmap(new_page, vma, haddr); > set_pmd_at(mm, haddr, pmd, entry); > @@ -2382,7 +2383,8 @@ static void collapse_huge_page(struct mm_struct *mm, > __SetPageUptodate(new_page); > pgtable = pmd_pgtable(_pmd); > > - _pmd = mk_huge_pmd(new_page, vma); > + _pmd = mk_huge_pmd(new_page, vma->vm_page_prot); > + _pmd = maybe_pmd_mkwrite(pmd_mkdirty(_pmd), vma); > > /* > * spin_lock() below is not the equivalent of smp_wmb(), so > -- > 1.7.10.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html