Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1525567 > unrolled thread

[HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages

Started byJérôme Glisse <jglisse@redhat.com>
First post2016-11-18 18:20 +0100
Last post2016-11-22 05:40 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:20 +0100
    Re: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch  ZONE_DEVICE pages Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 09:20 +0100
      Re: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch  ZONE_DEVICE pages Jerome Glisse <jglisse@redhat.com> - 2016-11-21 14:00 +0100
        Re: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch  ZONE_DEVICE pages Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-22 05:40 +0100

#1525567 — [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages

FromJérôme Glisse <jglisse@redhat.com>
Date2016-11-18 18:20 +0100
Subject[HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages
Message-ID<sEUZs-1B7-43@gated-at.bofh.it>
Catch page from ZONE_DEVICE in free_hot_cold_page(). This should never
happen as ZONE_DEVICE page must always have an elevated refcount.

This is to catch refcounting issues in a sane way for ZONE_DEVICE pages.

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 mm/page_alloc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0fbfead..09b2630 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2435,6 +2435,16 @@ void free_hot_cold_page(struct page *page, bool cold)
 	unsigned long pfn = page_to_pfn(page);
 	int migratetype;
 
+	/*
+	 * This should never happen ! Page from ZONE_DEVICE always must have an
+	 * active refcount. Complain about it and try to restore the refcount.
+	 */
+	if (is_zone_device_page(page)) {
+		VM_BUG_ON_PAGE(is_zone_device_page(page), page);
+		page_ref_inc(page);
+		return;
+	}
+
 	if (!free_pcp_prepare(page))
 		return;
 
-- 
2.4.3

[toc] | [next] | [standalone]


#1526435 — Re: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages

FromAnshuman Khandual <khandual@linux.vnet.ibm.com>
Date2016-11-21 09:20 +0100
SubjectRe: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages
Message-ID<sFRZv-7a5-3@gated-at.bofh.it>
In reply to#1525567
On 11/18/2016 11:48 PM, Jérôme Glisse wrote:
> Catch page from ZONE_DEVICE in free_hot_cold_page(). This should never
> happen as ZONE_DEVICE page must always have an elevated refcount.
> 
> This is to catch refcounting issues in a sane way for ZONE_DEVICE pages.
> 
> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> ---
>  mm/page_alloc.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0fbfead..09b2630 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2435,6 +2435,16 @@ void free_hot_cold_page(struct page *page, bool cold)
>  	unsigned long pfn = page_to_pfn(page);
>  	int migratetype;
>  
> +	/*
> +	 * This should never happen ! Page from ZONE_DEVICE always must have an
> +	 * active refcount. Complain about it and try to restore the refcount.
> +	 */
> +	if (is_zone_device_page(page)) {
> +		VM_BUG_ON_PAGE(is_zone_device_page(page), page);
> +		page_ref_inc(page);
> +		return;
> +	}

This fixes an issue in the existing ZONE_DEVICE code, should not this
patch be sent separately not in this series ?

[toc] | [prev] | [next] | [standalone]


#1526647 — Re: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages

FromJerome Glisse <jglisse@redhat.com>
Date2016-11-21 14:00 +0100
SubjectRe: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages
Message-ID<sFWmt-1in-1@gated-at.bofh.it>
In reply to#1526435
On Mon, Nov 21, 2016 at 01:48:26PM +0530, Anshuman Khandual wrote:
> On 11/18/2016 11:48 PM, Jérôme Glisse wrote:
> > Catch page from ZONE_DEVICE in free_hot_cold_page(). This should never
> > happen as ZONE_DEVICE page must always have an elevated refcount.
> > 
> > This is to catch refcounting issues in a sane way for ZONE_DEVICE pages.
> > 
> > Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> > ---
> >  mm/page_alloc.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 0fbfead..09b2630 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -2435,6 +2435,16 @@ void free_hot_cold_page(struct page *page, bool cold)
> >  	unsigned long pfn = page_to_pfn(page);
> >  	int migratetype;
> >  
> > +	/*
> > +	 * This should never happen ! Page from ZONE_DEVICE always must have an
> > +	 * active refcount. Complain about it and try to restore the refcount.
> > +	 */
> > +	if (is_zone_device_page(page)) {
> > +		VM_BUG_ON_PAGE(is_zone_device_page(page), page);
> > +		page_ref_inc(page);
> > +		return;
> > +	}
> 
> This fixes an issue in the existing ZONE_DEVICE code, should not this
> patch be sent separately not in this series ?
> 

Well this is more like a safetynet feature, i can send it separately from the
series. It is not an issue per say as a trap to catch bugs. I had refcounting
bugs while working on this patchset and having this safetynet was helpful to
quickly pin-point issues.

Cheers,
Jérôme

[toc] | [prev] | [next] | [standalone]


#1527221 — Re: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages

FromAnshuman Khandual <khandual@linux.vnet.ibm.com>
Date2016-11-22 05:40 +0100
SubjectRe: [HMM v13 03/18] mm/ZONE_DEVICE/free_hot_cold_page: catch ZONE_DEVICE pages
Message-ID<sGb29-2n8-1@gated-at.bofh.it>
In reply to#1526647
On 11/21/2016 06:20 PM, Jerome Glisse wrote:
> On Mon, Nov 21, 2016 at 01:48:26PM +0530, Anshuman Khandual wrote:
>> On 11/18/2016 11:48 PM, Jérôme Glisse wrote:
>>> Catch page from ZONE_DEVICE in free_hot_cold_page(). This should never
>>> happen as ZONE_DEVICE page must always have an elevated refcount.
>>>
>>> This is to catch refcounting issues in a sane way for ZONE_DEVICE pages.
>>>
>>> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
>>> Cc: Dan Williams <dan.j.williams@intel.com>
>>> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
>>> ---
>>>  mm/page_alloc.c | 10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>> index 0fbfead..09b2630 100644
>>> --- a/mm/page_alloc.c
>>> +++ b/mm/page_alloc.c
>>> @@ -2435,6 +2435,16 @@ void free_hot_cold_page(struct page *page, bool cold)
>>>  	unsigned long pfn = page_to_pfn(page);
>>>  	int migratetype;
>>>  
>>> +	/*
>>> +	 * This should never happen ! Page from ZONE_DEVICE always must have an
>>> +	 * active refcount. Complain about it and try to restore the refcount.
>>> +	 */
>>> +	if (is_zone_device_page(page)) {
>>> +		VM_BUG_ON_PAGE(is_zone_device_page(page), page);
>>> +		page_ref_inc(page);
>>> +		return;
>>> +	}
>>
>> This fixes an issue in the existing ZONE_DEVICE code, should not this
>> patch be sent separately not in this series ?
>>
> 
> Well this is more like a safetynet feature, i can send it separately from the
> series. It is not an issue per say as a trap to catch bugs. I had refcounting
> bugs while working on this patchset and having this safetynet was helpful to
> quickly pin-point issues.

Sure at the least move them up in the series as ZONE_DEVICE preparatory
fixes before expanding ZONE_DEVICE framework to accommodate the new
un-addressable memory representation.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web