linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] HWPOISON: Fix the handling path of the victimized page frame that belong to non-LUR
@ 2014-06-04  5:48 Chen Yucong
  2014-06-04  6:41 ` Naoya Horiguchi
       [not found] ` <538ebf9c.c71de50a.0f39.32bdSMTPIN_ADDED_BROKEN@mx.google.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Yucong @ 2014-06-04  5:48 UTC (permalink / raw)
  To: n-horiguchi; +Cc: ak, fengguang.wu, linux-mm, Chen Yucong

Until now, the kernel has the same policy to handle victimized page frames that
belong to kernel-space(reserved/slab-subsystem) or non-LRU(unknown page state).
In other word, the result of handling either of these victimized page frames is
(IGNORED | FAILED), and the return value of memory_failure() is -EBUSY.

This patch is to avoid that memory_failure() returns very soon due to the "true"
value of (!PageLRU(p)), and it also ensures that action_result() can report more
precise information("reserved kernel",  "kernel slab", and "unknown page state")
instead of "non LRU", especially for memory errors which are detected by memory-scrubbing.

Changes since v1: http://www.spinics.net/lists/linux-mm/msg74044.html
  - Call goto just after if (hwpoison_filter(p)) block, and jump directly to just 
    before the code determining the page_state, as suggested by Naoya Horiguchi.

Signed-off-by: Chen Yucong <slaoub@gmail.com>
---
 mm/memory-failure.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index e3154d9..1340b30 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -862,7 +862,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
 	struct page *hpage = *hpagep;
 	struct page *ppage;
 
-	if (PageReserved(p) || PageSlab(p))
+	if (PageReserved(p) || PageSlab(p) || !PageLRU(p))
 		return SWAP_SUCCESS;
 
 	/*
@@ -1126,9 +1126,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
 					action_result(pfn, "free buddy, 2nd try", DELAYED);
 				return 0;
 			}
-			action_result(pfn, "non LRU", IGNORED);
-			put_page(p);
-			return -EBUSY;
 		}
 	}
 
@@ -1161,6 +1158,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
 		return 0;
 	}
 
+	if (!PageHuge(p) && !PageTransTail(p) && !PageLRU(p))
+		goto identify_page_state;
+
 	/*
 	 * For error on the tail page, we should set PG_hwpoison
 	 * on the head page to show that the hugepage is hwpoisoned
@@ -1210,6 +1210,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
 		goto out;
 	}
 
+identify_page_state:
 	res = -EBUSY;
 	/*
 	 * The first check uses the current page flags which may not have any
-- 
1.7.10.4

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] HWPOISON: Fix the handling path of the victimized page frame that belong to non-LUR
  2014-06-04  5:48 [PATCH v2] HWPOISON: Fix the handling path of the victimized page frame that belong to non-LUR Chen Yucong
@ 2014-06-04  6:41 ` Naoya Horiguchi
       [not found] ` <538ebf9c.c71de50a.0f39.32bdSMTPIN_ADDED_BROKEN@mx.google.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Naoya Horiguchi @ 2014-06-04  6:41 UTC (permalink / raw)
  To: Chen Yucong; +Cc: ak, Wu Fengguang, linux-mm

On Wed, Jun 04, 2014 at 01:48:18PM +0800, Chen Yucong wrote:
> Until now, the kernel has the same policy to handle victimized page frames that
> belong to kernel-space(reserved/slab-subsystem) or non-LRU(unknown page state).
> In other word, the result of handling either of these victimized page frames is
> (IGNORED | FAILED), and the return value of memory_failure() is -EBUSY.
> 
> This patch is to avoid that memory_failure() returns very soon due to the "true"
> value of (!PageLRU(p)), and it also ensures that action_result() can report more
> precise information("reserved kernel",  "kernel slab", and "unknown page state")
> instead of "non LRU", especially for memory errors which are detected by memory-scrubbing.
> 
> Changes since v1: http://www.spinics.net/lists/linux-mm/msg74044.html
>   - Call goto just after if (hwpoison_filter(p)) block, and jump directly to just 
>     before the code determining the page_state, as suggested by Naoya Horiguchi.
> 
> Signed-off-by: Chen Yucong <slaoub@gmail.com>

Looks good to me, thanks!

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

> ---
>  mm/memory-failure.c |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index e3154d9..1340b30 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -862,7 +862,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
>  	struct page *hpage = *hpagep;
>  	struct page *ppage;
>  
> -	if (PageReserved(p) || PageSlab(p))
> +	if (PageReserved(p) || PageSlab(p) || !PageLRU(p))
>  		return SWAP_SUCCESS;
>  
>  	/*
> @@ -1126,9 +1126,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
>  					action_result(pfn, "free buddy, 2nd try", DELAYED);
>  				return 0;
>  			}
> -			action_result(pfn, "non LRU", IGNORED);
> -			put_page(p);
> -			return -EBUSY;
>  		}
>  	}
>  
> @@ -1161,6 +1158,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
>  		return 0;
>  	}
>  
> +	if (!PageHuge(p) && !PageTransTail(p) && !PageLRU(p))
> +		goto identify_page_state;
> +
>  	/*
>  	 * For error on the tail page, we should set PG_hwpoison
>  	 * on the head page to show that the hugepage is hwpoisoned
> @@ -1210,6 +1210,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
>  		goto out;
>  	}
>  
> +identify_page_state:
>  	res = -EBUSY;
>  	/*
>  	 * The first check uses the current page flags which may not have any
> -- 
> 1.7.10.4
> 
> --
> 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>
> 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] HWPOISON: Fix the handling path of the victimized page frame that belong to non-LUR
       [not found] ` <538ebf9c.c71de50a.0f39.32bdSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2014-06-11  2:11   ` Chen Yucong
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Yucong @ 2014-06-11  2:11 UTC (permalink / raw)
  To: Andrew Morton; +Cc: ak, Wu Fengguang, linux-mm, Naoya Horiguchi

Hi Andrew Morton,

The following message should be cc'ed to you. This is my negligence.

thx!
cyc
On Wed, 2014-06-04 at 02:41 -0400, Naoya Horiguchi wrote:
> On Wed, Jun 04, 2014 at 01:48:18PM +0800, Chen Yucong wrote:
> > Until now, the kernel has the same policy to handle victimized page frames that
> > belong to kernel-space(reserved/slab-subsystem) or non-LRU(unknown page state).
> > In other word, the result of handling either of these victimized page frames is
> > (IGNORED | FAILED), and the return value of memory_failure() is -EBUSY.
> > 
> > This patch is to avoid that memory_failure() returns very soon due to the "true"
> > value of (!PageLRU(p)), and it also ensures that action_result() can report more
> > precise information("reserved kernel",  "kernel slab", and "unknown page state")
> > instead of "non LRU", especially for memory errors which are detected by memory-scrubbing.
> > 
> > Changes since v1: http://www.spinics.net/lists/linux-mm/msg74044.html
> >   - Call goto just after if (hwpoison_filter(p)) block, and jump directly to just 
> >     before the code determining the page_state, as suggested by Naoya Horiguchi.
> > 
> > Signed-off-by: Chen Yucong <slaoub@gmail.com>
> 
> Looks good to me, thanks!
> 
> Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> 
> > ---
> >  mm/memory-failure.c |    9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> > index e3154d9..1340b30 100644
> > --- a/mm/memory-failure.c
> > +++ b/mm/memory-failure.c
> > @@ -862,7 +862,7 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
> >  	struct page *hpage = *hpagep;
> >  	struct page *ppage;
> >  
> > -	if (PageReserved(p) || PageSlab(p))
> > +	if (PageReserved(p) || PageSlab(p) || !PageLRU(p))
> >  		return SWAP_SUCCESS;
> >  
> >  	/*
> > @@ -1126,9 +1126,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
> >  					action_result(pfn, "free buddy, 2nd try", DELAYED);
> >  				return 0;
> >  			}
> > -			action_result(pfn, "non LRU", IGNORED);
> > -			put_page(p);
> > -			return -EBUSY;
> >  		}
> >  	}
> >  
> > @@ -1161,6 +1158,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
> >  		return 0;
> >  	}
> >  
> > +	if (!PageHuge(p) && !PageTransTail(p) && !PageLRU(p))
> > +		goto identify_page_state;
> > +
> >  	/*
> >  	 * For error on the tail page, we should set PG_hwpoison
> >  	 * on the head page to show that the hugepage is hwpoisoned
> > @@ -1210,6 +1210,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
> >  		goto out;
> >  	}
> >  
> > +identify_page_state:
> >  	res = -EBUSY;
> >  	/*
> >  	 * The first check uses the current page flags which may not have any
> > -- 
> > 1.7.10.4
> > 
> > --
> > 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>
> > 


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-11  2:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-04  5:48 [PATCH v2] HWPOISON: Fix the handling path of the victimized page frame that belong to non-LUR Chen Yucong
2014-06-04  6:41 ` Naoya Horiguchi
     [not found] ` <538ebf9c.c71de50a.0f39.32bdSMTPIN_ADDED_BROKEN@mx.google.com>
2014-06-11  2:11   ` Chen Yucong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).