All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Glisse <jglisse@redhat.com>
To: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: linux-mm@kvack.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v11 02/14] HMM: add special swap filetype for memory migrated to device v2.
Date: Thu, 22 Oct 2015 10:21:44 -0400	[thread overview]
Message-ID: <20151022142144.GB2914@redhat.com> (raw)
In-Reply-To: <05f501d10c9e$a8562900$f9027b00$@alibaba-inc.com>

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,
Jerome

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Jerome Glisse <jglisse@redhat.com>
To: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: linux-mm@kvack.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v11 02/14] HMM: add special swap filetype for memory migrated to device v2.
Date: Thu, 22 Oct 2015 10:21:44 -0400	[thread overview]
Message-ID: <20151022142144.GB2914@redhat.com> (raw)
In-Reply-To: <05f501d10c9e$a8562900$f9027b00$@alibaba-inc.com>

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

  reply	other threads:[~2015-10-22 14:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <05ec01d10c9b$4df7ba80$e9e72f80$@alibaba-inc.com>
2015-10-22  7:52 ` [PATCH v11 02/14] HMM: add special swap filetype for memory migrated to device v2 Hillf Danton
2015-10-22  7:52   ` Hillf Danton
2015-10-22 14:21   ` Jerome Glisse [this message]
2015-10-22 14:21     ` Jerome Glisse
2015-10-23  3:23     ` Hillf Danton
2015-10-23  3:23       ` Hillf Danton
2015-10-23  3:54       ` Jerome Glisse
2015-10-23  3:54         ` Jerome Glisse
2015-10-21 21:10 [PATCH v11 00/14] HMM anomymous memory migration to device memory Jérôme Glisse
2015-10-21 21:10 ` [PATCH v11 02/14] HMM: add special swap filetype for memory migrated to device v2 Jérôme Glisse
2015-10-21 21:10   ` Jérôme Glisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151022142144.GB2914@redhat.com \
    --to=jglisse@redhat.com \
    --cc=hillf.zj@alibaba-inc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.