linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: hwpoison: Use compound_head() flags for huge pages
@ 2017-05-24 13:02 James Morse
  2017-05-24 15:57 ` Punit Agrawal
  2017-05-24 23:30 ` Naoya Horiguchi
  0 siblings, 2 replies; 3+ messages in thread
From: James Morse @ 2017-05-24 13:02 UTC (permalink / raw)
  To: linux-mm; +Cc: Naoya Horiguchi, James Morse, Punit Agrawal

memory_failure() chooses a recovery action function based on the page
flags. For huge pages it uses the tail page flags which don't have
anything interesting set, resulting in:
> Memory failure: 0x9be3b4: Unknown page state
> Memory failure: 0x9be3b4: recovery action for unknown page: Failed

Instead, save a copy of the head page's flags if this is a huge page,
this means if there are no relevant flags for this tail page, we use
the head pages flags instead. This results in the me_huge_page()
recovery action being called:
> Memory failure: 0x9b7969: recovery action for huge page: Delayed

For hugepages that have not yet been allocated, this allows the hugepage
to be dequeued.

CC: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
---
This is intended as a fix, but I can't find the patch that introduced this
behaviour. (not recent, and there is a lot of history down there!)

This doesn't apply to stable trees before v3.10...
Cc: stable@vger.kernel.org # 3.10.105

 mm/memory-failure.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 2527dfeddb00..44a6a33af219 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1184,7 +1184,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
 	 * page_remove_rmap() in try_to_unmap_one(). So to determine page status
 	 * correctly, we save a copy of the page flags at this time.
 	 */
-	page_flags = p->flags;
+	if (PageHuge(p))
+		page_flags = hpage->flags;
+	else
+		page_flags = p->flags;
 
 	/*
 	 * unpoison always clear PG_hwpoison inside page lock
-- 
2.11.0

--
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] mm: hwpoison: Use compound_head() flags for huge pages
  2017-05-24 13:02 [PATCH] mm: hwpoison: Use compound_head() flags for huge pages James Morse
@ 2017-05-24 15:57 ` Punit Agrawal
  2017-05-24 23:30 ` Naoya Horiguchi
  1 sibling, 0 replies; 3+ messages in thread
From: Punit Agrawal @ 2017-05-24 15:57 UTC (permalink / raw)
  To: James Morse; +Cc: linux-mm, Naoya Horiguchi

James Morse <james.morse@arm.com> writes:

> memory_failure() chooses a recovery action function based on the page
> flags. For huge pages it uses the tail page flags which don't have
> anything interesting set, resulting in:
>> Memory failure: 0x9be3b4: Unknown page state
>> Memory failure: 0x9be3b4: recovery action for unknown page: Failed
>
> Instead, save a copy of the head page's flags if this is a huge page,
> this means if there are no relevant flags for this tail page, we use
> the head pages flags instead. This results in the me_huge_page()
> recovery action being called:
>> Memory failure: 0x9b7969: recovery action for huge page: Delayed
>
> For hugepages that have not yet been allocated, this allows the hugepage
> to be dequeued.
>
> CC: Punit Agrawal <punit.agrawal@arm.com>
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> This is intended as a fix, but I can't find the patch that introduced this
> behaviour. (not recent, and there is a lot of history down there!)
>
> This doesn't apply to stable trees before v3.10...
> Cc: stable@vger.kernel.org # 3.10.105
>
>  mm/memory-failure.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 2527dfeddb00..44a6a33af219 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1184,7 +1184,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
>  	 * page_remove_rmap() in try_to_unmap_one(). So to determine page status
>  	 * correctly, we save a copy of the page flags at this time.
>  	 */
> -	page_flags = p->flags;
> +	if (PageHuge(p))
> +		page_flags = hpage->flags;
> +	else
> +		page_flags = p->flags;
>  
>  	/*
>  	 * unpoison always clear PG_hwpoison inside page lock

I can confirm that this patch reduces the number of failing cases when
running hugepage tests from mce-tests suite.

FWIW,

Acked-by: Punit Agrawal <punit.agrawal@arm.com>
Tested-by: Punit Agrawal <punit.agrawal@arm.com>

Thanks!

--
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] mm: hwpoison: Use compound_head() flags for huge pages
  2017-05-24 13:02 [PATCH] mm: hwpoison: Use compound_head() flags for huge pages James Morse
  2017-05-24 15:57 ` Punit Agrawal
@ 2017-05-24 23:30 ` Naoya Horiguchi
  1 sibling, 0 replies; 3+ messages in thread
From: Naoya Horiguchi @ 2017-05-24 23:30 UTC (permalink / raw)
  To: James Morse; +Cc: linux-mm, Punit Agrawal

On Wed, May 24, 2017 at 02:02:04PM +0100, James Morse wrote:
> memory_failure() chooses a recovery action function based on the page
> flags. For huge pages it uses the tail page flags which don't have
> anything interesting set, resulting in:
> > Memory failure: 0x9be3b4: Unknown page state
> > Memory failure: 0x9be3b4: recovery action for unknown page: Failed
> 
> Instead, save a copy of the head page's flags if this is a huge page,
> this means if there are no relevant flags for this tail page, we use
> the head pages flags instead. This results in the me_huge_page()
> recovery action being called:
> > Memory failure: 0x9b7969: recovery action for huge page: Delayed
> 
> For hugepages that have not yet been allocated, this allows the hugepage
> to be dequeued.
> 
> CC: Punit Agrawal <punit.agrawal@arm.com>
> Signed-off-by: James Morse <james.morse@arm.com>

Looks good to me.

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

> ---
> This is intended as a fix, but I can't find the patch that introduced this
> behaviour. (not recent, and there is a lot of history down there!)

Please add a tag

Fixes: 524fca1e7356 ("HWPOISON: fix misjudgement of page_action() for errors on mlocked pages")

> 
> This doesn't apply to stable trees before v3.10...
> Cc: stable@vger.kernel.org # 3.10.105

You can skip older stable kernels to which the fix isn't cleanly applicable.

Thanks,
Naoya Horiguchi

> 
>  mm/memory-failure.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 2527dfeddb00..44a6a33af219 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1184,7 +1184,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
>  	 * page_remove_rmap() in try_to_unmap_one(). So to determine page status
>  	 * correctly, we save a copy of the page flags at this time.
>  	 */
> -	page_flags = p->flags;
> +	if (PageHuge(p))
> +		page_flags = hpage->flags;
> +	else
> +		page_flags = p->flags;
>  
>  	/*
>  	 * unpoison always clear PG_hwpoison inside page lock
> -- 
> 2.11.0
> 
> 
--
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:[~2017-05-24 23:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 13:02 [PATCH] mm: hwpoison: Use compound_head() flags for huge pages James Morse
2017-05-24 15:57 ` Punit Agrawal
2017-05-24 23:30 ` Naoya Horiguchi

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