[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190728175617.GA5391@bharath12345-Inspiron-5559>
Date: Sun, 28 Jul 2019 23:26:17 +0530
From: Bharath Vedartham <linux.bhar@...il.com>
To: Hillf Danton <hdanton@...a.com>
Cc: sivanich@....com, arnd@...db.de, ira.weiny@...el.com,
jhubbard@...dia.com, jglisse@...hat.com,
gregkh@...uxfoundation.org, william.kucharski@...cle.com,
hch@....de, linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v3 1/1] sgi-gru: Remove *pte_lookup functions
On Sat, Jul 27, 2019 at 05:22:28PM +0800, Hillf Danton wrote:
>
> On Fri, 26 Jul 2019 12:42:26 -0700 (PDT) Bharath Vedartham wrote:
> >
> > static int gru_vtop(struct gru_thread_state *gts, unsigned long vaddr,
> > int write, int atomic, unsigned long *gpa, int *pageshift)
> > {
> > struct mm_struct *mm = gts->ts_mm;
> > struct vm_area_struct *vma;
> > unsigned long paddr;
> > - int ret, ps;
> > + int ret;
> > + struct page *page;
> >
> > vma = find_vma(mm, vaddr);
> > if (!vma)
> > @@ -263,21 +187,33 @@ static int gru_vtop(struct gru_thread_state *gts, unsigned long vaddr,
> >
> > /*
> > * Atomic lookup is faster & usually works even if called in non-atomic
> > - * context.
> > + * context. get_user_pages_fast does atomic lookup before falling back to
> > + * slow gup.
> > */
> > rmb(); /* Must/check ms_range_active before loading PTEs */
> > - ret = atomic_pte_lookup(vma, vaddr, write, &paddr, &ps);
> > - if (ret) {
> > - if (atomic)
> > + if (atomic) {
> > + ret = __get_user_pages_fast(vaddr, 1, write, &page);
> > + if (!ret)
> > goto upm;
> > - if (non_atomic_pte_lookup(vma, vaddr, write, &paddr, &ps))
> > + } else {
> > + ret = get_user_pages_fast(vaddr, 1, write, &page);
> > + if (!ret)
> > goto inval;
> > }
> > +
> > + paddr = page_to_phys(page);
>
> You may drop find_vma() above if PageHuge(page) makes sense here.
I don't think it does. Hugepage support is still incomplete for this
driver.
Thank you
Bharath
> > + put_user_page(page);
> > +
> > + if (unlikely(is_vm_hugetlb_page(vma)))
> > + *pageshift = HPAGE_SHIFT;
> > + else
> > + *pageshift = PAGE_SHIFT;
> > +
> > if (is_gru_paddr(paddr))
> > goto inval;
> > - paddr = paddr & ~((1UL << ps) - 1);
> > - *gpa = uv_soc_phys_ram_to_gpa(paddr);
> > - *pageshift = ps;
> > + paddr = paddr & ~((1UL << *pageshift) - 1);
> > + *gpa = uv_soc_phys_ram_to_gpa(paddr);
> > +
> > return VTOP_SUCCESS;
> >
> > inval:
> > --
> > 2.7.4
>
Powered by blists - more mailing lists