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


Groups > linux.kernel > #1201546 > unrolled thread

[PATCH] mm/hwpoison: fix page refcount of unkown non LRU page

Started byWanpeng Li <wanpeng.li@hotmail.com>
First post2015-08-06 10:20 +0200
Last post2015-08-07 11:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm/hwpoison: fix page refcount of unkown non LRU page Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-06 10:20 +0200
    Re: [PATCH] mm/hwpoison: fix page refcount of unkown non LRU page Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2015-08-07 10:00 +0200
      Re: [PATCH] mm/hwpoison: fix page refcount of unkown non LRU page Wanpeng Li <wanpeng.li@hotmail.com> - 2015-08-07 11:30 +0200

#1201546 — [PATCH] mm/hwpoison: fix page refcount of unkown non LRU page

FromWanpeng Li <wanpeng.li@hotmail.com>
Date2015-08-06 10:20 +0200
Subject[PATCH] mm/hwpoison: fix page refcount of unkown non LRU page
Message-ID<pUoz7-39z-3@gated-at.bofh.it>
After try to drain pages from pagevec/pageset, we try to get reference
count of the page again, however, the reference count of the page is 
not reduced if the page is still not on LRU list. This patch fix it by 
adding the put_page() to drop the page reference which is from 
__get_any_page().

Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com> 
---
 mm/memory-failure.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index c53543d..23163d0 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1535,6 +1535,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags)
 		 */
 		ret = __get_any_page(page, pfn, 0);
 		if (!PageLRU(page)) {
+			/* Drop page reference which is from __get_any_page() */
+			put_page(page);
 			pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n",
 				pfn, page->flags);
 			return -EIO;
-- 
1.7.1

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

[toc] | [next] | [standalone]


#1202395

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2015-08-07 10:00 +0200
Message-ID<pUKJj-1Az-1@gated-at.bofh.it>
In reply to#1201546
On Thu, Aug 06, 2015 at 04:09:37PM +0800, Wanpeng Li wrote:
> After try to drain pages from pagevec/pageset, we try to get reference
> count of the page again, however, the reference count of the page is 
> not reduced if the page is still not on LRU list. This patch fix it by 
> adding the put_page() to drop the page reference which is from 
> __get_any_page().
> 
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com> 

This fix is correct. Thanks you for catching this, Wanpeng!

Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

BTW, I think this patch is worth sending to stable tree. It seems that
the latest change around this code is given by the following commit:

  commit af8fae7c08862bb85c5cf445bf9b36314b82111f
  Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
  Date:   Fri Feb 22 16:34:03 2013 -0800
  
      mm/memory-failure.c: clean up soft_offline_page()

. I think that this bug existed before this commit, but this patch is
cleanly applicable only after this patch, so I think tagging
"Cc: stable@vger.kernel.org # 3.9+" is good.

Thanks,
Naoya Horiguchi

> ---
>  mm/memory-failure.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index c53543d..23163d0 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1535,6 +1535,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags)
>  		 */
>  		ret = __get_any_page(page, pfn, 0);
>  		if (!PageLRU(page)) {
> +			/* Drop page reference which is from __get_any_page() */
> +			put_page(page);
>  			pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n",
>  				pfn, page->flags);
>  			return -EIO;
> -- 
> 1.7.1
> --
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


#1202506

FromWanpeng Li <wanpeng.li@hotmail.com>
Date2015-08-07 11:30 +0200
Message-ID<pUM8r-3JH-37@gated-at.bofh.it>
In reply to#1202395

On 8/7/15 3:46 PM, Naoya Horiguchi wrote:
> On Thu, Aug 06, 2015 at 04:09:37PM +0800, Wanpeng Li wrote:
>> After try to drain pages from pagevec/pageset, we try to get reference
>> count of the page again, however, the reference count of the page is 
>> not reduced if the page is still not on LRU list. This patch fix it by 
>> adding the put_page() to drop the page reference which is from 
>> __get_any_page().
>>
>> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com> 
> This fix is correct. Thanks you for catching this, Wanpeng!
>
> Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Thanks, :)

>
> BTW, I think this patch is worth sending to stable tree. It seems that
> the latest change around this code is given by the following commit:
>
>   commit af8fae7c08862bb85c5cf445bf9b36314b82111f
>   Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
>   Date:   Fri Feb 22 16:34:03 2013 -0800
>   
>       mm/memory-failure.c: clean up soft_offline_page()
>
> . I think that this bug existed before this commit, but this patch is
> cleanly applicable only after this patch, so I think tagging
> "Cc: stable@vger.kernel.org # 3.9+" is good.

I will add this in v2.

Regards,
Wanpeng Li

>
> Thanks,
> Naoya Horiguchi
>
>> ---
>>  mm/memory-failure.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>> index c53543d..23163d0 100644
>> --- a/mm/memory-failure.c
>> +++ b/mm/memory-failure.c
>> @@ -1535,6 +1535,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags)
>>  		 */
>>  		ret = __get_any_page(page, pfn, 0);
>>  		if (!PageLRU(page)) {
>> +			/* Drop page reference which is from __get_any_page() */
>> +			put_page(page);
>>  			pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n",
>>  				pfn, page->flags);
>>  			return -EIO;
>> -- 
>> 1.7.1

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web