On 21/05/2015 22:31, j.gli...@gmail.com wrote:
> From: Jerome Glisse <jgli...@redhat.com>
> 
> When migrating anonymous memory from system memory to device memory
> CPU pte are replaced with special HMM swap entry so that page fault,
> get user page (gup), fork, ... are properly redirected to HMM helpers.
> 
> This patch only add the new swap type entry and hooks HMM helpers
> functions inside the page fault and fork code path.
> 
> Signed-off-by: Jérôme Glisse <jgli...@redhat.com>
> Signed-off-by: Sherry Cheung <sche...@nvidia.com>
> Signed-off-by: Subhash Gutti <sgu...@nvidia.com>
> Signed-off-by: Mark Hairgrove <mhairgr...@nvidia.com>
> Signed-off-by: John Hubbard <jhubb...@nvidia.com>
> Signed-off-by: Jatin Kumar <jaku...@nvidia.com>
> ---
>  include/linux/hmm.h     | 34 ++++++++++++++++++++++++++++++++++
>  include/linux/swap.h    | 12 +++++++++++-
>  include/linux/swapops.h | 43 ++++++++++++++++++++++++++++++++++++++++++-
>  mm/hmm.c                | 21 +++++++++++++++++++++
>  mm/memory.c             | 22 ++++++++++++++++++++++
>  5 files changed, 130 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/hmm.h b/include/linux/hmm.h
> index 186f497..f243eb5 100644
> --- a/include/linux/hmm.h
> +++ b/include/linux/hmm.h
> @@ -257,6 +257,40 @@ void hmm_mirror_range_dirty(struct hmm_mirror *mirror,
>                           unsigned long start,
>                           unsigned long end);
>  
> +int hmm_handle_cpu_fault(struct mm_struct *mm,
> +                     struct vm_area_struct *vma,
> +                     pmd_t *pmdp, unsigned long addr,
> +                     unsigned flags, pte_t orig_pte);
> +
> +int hmm_mm_fork(struct mm_struct *src_mm,
> +             struct mm_struct *dst_mm,
> +             struct vm_area_struct *dst_vma,
> +             pmd_t *dst_pmd,
> +             unsigned long start,
> +             unsigned long end);
> +
> +#else /* CONFIG_HMM */
> +
> +static inline int hmm_handle_mm_fault(struct mm_struct *mm,
I think this should be hmm_handle_cpu_fault, to match the function
declared above in the CONFIG_HMM case.

> +                                   struct vm_area_struct *vma,
> +                                   pmd_t *pmdp, unsigned long addr,
> +                                   unsigned flags, pte_t orig_pte)
> +{
> +     return VM_FAULT_SIGBUS;
> +}
> +
> +static inline int hmm_mm_fork(struct mm_struct *src_mm,
> +                           struct mm_struct *dst_mm,
> +                           struct vm_area_struct *dst_vma,
> +                           pmd_t *dst_pmd,
> +                           unsigned long start,
> +                           unsigned long end)
> +{
> +     BUG();
> +     return -ENOMEM;
> +}
>  
>  #endif /* CONFIG_HMM */
> +
> +
>  #endif

Regards,
Haggai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to