Re: [PATCH v11 02/14] HMM: add special swap filetype for memory migrated to device v2.
From: Jerome Glisse
Date: Thu Oct 22 2015 - 10:21:51 EST
On Thu, Oct 22, 2015 at 03:52:53PM +0800, Hillf Danton wrote:
> >
> > 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.
> >
> > Changed since v1:
>
> But the subject line says this work is v11
This is the v11 of the whole patchset. But this particular patch only
add 2 different version (v2 at the end of subject line). I do not bump
version of patches each time i rebase this seems pointless.
> > diff --git a/include/linux/hmm.h b/include/linux/hmm.h
> > index 4bc132a..7c66513 100644
> > --- a/include/linux/hmm.h
> > +++ b/include/linux/hmm.h
>
> I find no hmm.h in 4.3-rc6
This patchset depends on patchset i posted before this one and that the
introduction mail reference namely :
https://lkml.org/lkml/2015/10/21/739
[...]
> > +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();
>
> s/BUG/BUILD_BUG/ ?
I use BUG(); to keep bisectability working. The core of this function
is implemented in a latter patch but this function is reference in
this one.
[...]
> > +#ifdef CONFIG_HMM
> > +static inline swp_entry_t make_hmm_entry(void)
> > +{
> > + /* We do not store anything inside the CPU page table entry (pte). */
>
> pte is clear enough, no?
Yes i will remove this redundancy.
[...]
> > +static inline int is_hmm_entry_poisonous(swp_entry_t entry)
> > +{
> > + return (swp_type(entry) == SWP_HMM) && (swp_offset(entry) == 2);
> > +}
>
> So SWP_HMM_LOCKED and SWP_HMM_POISON should be defined.
Good point.
[...]
> > @@ -894,9 +895,11 @@ static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
> > pte_t *orig_src_pte, *orig_dst_pte;
> > pte_t *src_pte, *dst_pte;
> > spinlock_t *src_ptl, *dst_ptl;
> > + unsigned cnt_hmm_entry = 0;
>
> s/cnt_hmm_entry/hmm_ptes/ ?
>
Maybe hmm_swap_ptes is even better name in this context.
[...]
> > + if (cnt_hmm_entry) {
> > + int ret;
> > +
> > + ret = hmm_mm_fork(src_mm, dst_mm, dst_vma,
> > + dst_pmd, start, end);
>
> Given start, s/end/addr/, no?
No, end is the right upper limit here.
Cheers,
Jérôme
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/