Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-18 Thread Dave Hansen
On 04/18/2013 09:38 AM, Kirill A. Shutemov wrote: > Dave Hansen wrote: >> On 04/18/2013 09:09 AM, Kirill A. Shutemov wrote: >>> Dave Hansen wrote: On 04/17/2013 07:38 AM, Kirill A. Shutemov wrote: Are you still sure you can't do _any_ better than a verbatim copy of 129 lines? >>> >>>

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-18 Thread Kirill A. Shutemov
Dave Hansen wrote: > On 04/18/2013 09:09 AM, Kirill A. Shutemov wrote: > > Dave Hansen wrote: > >> On 04/17/2013 07:38 AM, Kirill A. Shutemov wrote: > >> Are you still sure you can't do _any_ better than a verbatim copy of 129 > >> lines? > > > > It seems I was too lazy. Shame on me. :( > > Here's

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-18 Thread Dave Hansen
On 04/18/2013 09:09 AM, Kirill A. Shutemov wrote: > Dave Hansen wrote: >> On 04/17/2013 07:38 AM, Kirill A. Shutemov wrote: >> Are you still sure you can't do _any_ better than a verbatim copy of 129 >> lines? > > It seems I was too lazy. Shame on me. :( > Here's consolidated version. Only build t

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-18 Thread Kirill A. Shutemov
Kirill A. Shutemov wrote: > diff --git a/include/linux/mm.h b/include/linux/mm.h > index c8a8626..4669c19 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -165,6 +165,11 @@ extern pgprot_t protection_map[16]; > #define FAULT_FLAG_RETRY_NOWAIT 0x10/* Don't drop mmap_sem an

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-18 Thread Kirill A. Shutemov
Dave Hansen wrote: > On 04/17/2013 07:38 AM, Kirill A. Shutemov wrote: > Are you still sure you can't do _any_ better than a verbatim copy of 129 > lines? It seems I was too lazy. Shame on me. :( Here's consolidated version. Only build tested. Does it look better? diff --git a/include/linux/huge_

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-17 Thread Dave Hansen
On 04/17/2013 07:38 AM, Kirill A. Shutemov wrote: >> > Ugh. This is essentially a copy-n-paste of code in __do_fault(), >> > including the comments. Is there no way to consolidate the code so that >> > there's less duplication here? > I've looked into it once again and it seems there's not much s

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-17 Thread Kirill A. Shutemov
Dave Hansen wrote: > On 04/05/2013 04:59 AM, Kirill A. Shutemov wrote: > > +int do_huge_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, > > + unsigned long address, pmd_t *pmd, unsigned int flags) > > +{ > > + unsigned long haddr = address & HPAGE_PMD_MASK; > > + struct

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-08 Thread Dave Hansen
On 04/05/2013 04:59 AM, Kirill A. Shutemov wrote: > +int do_huge_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, > + unsigned long address, pmd_t *pmd, unsigned int flags) > +{ > + unsigned long haddr = address & HPAGE_PMD_MASK; > + struct page *cow_page, *page, *

Re: [PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-08 Thread Dave Hansen
On 04/05/2013 04:59 AM, Kirill A. Shutemov wrote: > + if (unlikely(khugepaged_enter(vma))) > + return VM_FAULT_OOM; ... > + ret = vma->vm_ops->huge_fault(vma, &vmf); > + if (unlikely(ret & VM_FAULT_OOM)) > + goto uncharge_out_fallback; > + if (unlikely(ret &

[PATCHv3, RFC 31/34] thp: initial implementation of do_huge_linear_fault()

2013-04-05 Thread Kirill A. Shutemov
From: "Kirill A. Shutemov" The function tries to create a new page mapping using huge pages. It only called for not yet mapped pages. As usual in THP, we fallback to small pages if we fail to allocate huge page. Signed-off-by: Kirill A. Shutemov --- include/linux/huge_mm.h |3 + mm/huge_m