Re: [PATCH 12/25] memremap: add a migrate_to_ram method to struct dev_pagemap_ops

From: Christoph Hellwig
Date: Thu Jun 27 2019 - 13:01:54 EST


On Thu, Jun 27, 2019 at 04:29:45PM +0000, Jason Gunthorpe wrote:
> I'ver heard there are some other use models for fault() here beyond
> migrate to ram, but we can rename it if we ever see them.

Well, it absolutely needs to migrate to some piece of addressable
and coherent memory, so ram might be a nice shortcut for that.

> > +static vm_fault_t hmm_devmem_migrate_to_ram(struct vm_fault *vmf)
> > {
> > - struct hmm_devmem *devmem = page->pgmap->data;
> > + struct hmm_devmem *devmem = vmf->page->pgmap->data;
> >
> > - return devmem->ops->fault(devmem, vma, addr, page, flags, pmdp);
> > + return devmem->ops->fault(devmem, vmf->vma, vmf->address, vmf->page,
> > + vmf->flags, vmf->pmd);
> > }
>
> Next cycle we should probably rename this fault to migrate_to_ram as
> well and pass in the vmf..

That ->fault op goes away entirely in one of the next patches in the
series.