Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable
From: Jerome Glisse
Date: Mon Nov 21 2016 - 07:42:26 EST
On Mon, Nov 21, 2016 at 04:28:04PM +0530, Anshuman Khandual wrote:
> On 11/18/2016 11:48 PM, Jérôme Glisse wrote:
> > To allow use of device un-addressable memory inside a process add a
> > special swap type. Also add a new callback to handle page fault on
> > such entry.
>
> IIUC this swap type is required only for the mirror cases and its
> not a requirement for migration. If it's required for mirroring
> purpose where we intercept each page fault, the commit message
> here should clearly elaborate on that more.
It is only require for un-addressable memory. The mirroring has nothing to do
with it. I will clarify commit message.
[...]
> > diff --git a/include/linux/memremap.h b/include/linux/memremap.h
> > index b6f03e9..d584c74 100644
> > --- a/include/linux/memremap.h
> > +++ b/include/linux/memremap.h
> > @@ -47,6 +47,11 @@ static inline struct vmem_altmap *to_vmem_altmap(unsigned long memmap_start)
> > */
> > struct dev_pagemap {
> > void (*free_devpage)(struct page *page, void *data);
> > + int (*fault)(struct vm_area_struct *vma,
> > + unsigned long addr,
> > + struct page *page,
> > + unsigned flags,
> > + pmd_t *pmdp);
>
> We are extending the dev_pagemap once again to accommodate device driver
> specific fault routines for these pages. Wondering if this extension and
> the new swap type should be in the same patch.
It make sense to have it in one single patch as i also change page fault code
path to deal with the new special swap entry and those make use of this new
callback.
> > +int device_entry_fault(struct vm_area_struct *vma,
> > + unsigned long addr,
> > + swp_entry_t entry,
> > + unsigned flags,
> > + pmd_t *pmdp)
> > +{
> > + struct page *page = device_entry_to_page(entry);
> > +
>
> A BUG_ON() if page->pgmap->fault has not been populated by the driver.
>
Ok
Cheers,
Jérôme