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


Groups > linux.kernel > #1314827 > unrolled thread

[PATCH v1] mm/madvise: pass return code of memory_failure() to userspace

Started byNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
First post2016-01-22 09:30 +0100
Last post2016-01-27 15:00 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-01-22 09:30 +0100
    Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to  userspace Andrew Morton <akpm@linux-foundation.org> - 2016-01-27 00:30 +0100
      Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to  userspace Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-01-27 02:30 +0100
    Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to  userspace Vlastimil Babka <vbabka@suse.cz> - 2016-01-27 15:00 +0100

#1314827 — [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2016-01-22 09:30 +0100
Subject[PATCH v1] mm/madvise: pass return code of memory_failure() to userspace
Message-ID<qTFgu-1rB-11@gated-at.bofh.it>
Currently the return value of memory_failure() is not passed to userspace, which
is inconvenient for test programs that want to know the result of error handling.
So let's return it to the caller as we already do in MADV_SOFT_OFFLINE case.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/madvise.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git v4.4-mmotm-2016-01-20-16-10/mm/madvise.c v4.4-mmotm-2016-01-20-16-10_patched/mm/madvise.c
index f56825b..6a77114 100644
--- v4.4-mmotm-2016-01-20-16-10/mm/madvise.c
+++ v4.4-mmotm-2016-01-20-16-10_patched/mm/madvise.c
@@ -555,8 +555,9 @@ static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end)
 		}
 		pr_info("Injecting memory failure for page %#lx at %#lx\n",
 		       page_to_pfn(p), start);
-		/* Ignore return value for now */
-		memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED);
+		ret = memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED);
+		if (ret)
+			return ret;
 	}
 	return 0;
 }
-- 
2.7.0

[toc] | [next] | [standalone]


#1318466 — Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-01-27 00:30 +0100
SubjectRe: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace
Message-ID<qVldE-33s-17@gated-at.bofh.it>
In reply to#1314827
On Fri, 22 Jan 2016 17:27:57 +0900 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:

> Currently the return value of memory_failure() is not passed to userspace, which
> is inconvenient for test programs that want to know the result of error handling.
> So let's return it to the caller as we already do in MADV_SOFT_OFFLINE case.

I updated this to mention that it's for madvise(MADV_HWPOISON):

: Currently the return value of memory_failure() is not passed to userspace
: when madvise(MADV_HWPOISON) is used.  This is inconvenient for test
: programs that want to know the result of error handling.  So let's return
: it to the caller as we already do in the MADV_SOFT_OFFLINE case.

btw, MADV_SOFT_OFFLINE and MADV_HWPOISON are not documented in that
comment block over sys_madvise().  Fixy please?  You might want to
check that no other MADV_foo values have been omitted.

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


#1318528 — Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2016-01-27 02:30 +0100
SubjectRe: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace
Message-ID<qVn5L-4lp-1@gated-at.bofh.it>
In reply to#1318466
On Tue, Jan 26, 2016 at 03:27:58PM -0800, Andrew Morton wrote:
> On Fri, 22 Jan 2016 17:27:57 +0900 Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> wrote:
> 
> > Currently the return value of memory_failure() is not passed to userspace, which
> > is inconvenient for test programs that want to know the result of error handling.
> > So let's return it to the caller as we already do in MADV_SOFT_OFFLINE case.
> 
> I updated this to mention that it's for madvise(MADV_HWPOISON):
> 
> : Currently the return value of memory_failure() is not passed to userspace
> : when madvise(MADV_HWPOISON) is used.  This is inconvenient for test
> : programs that want to know the result of error handling.  So let's return
> : it to the caller as we already do in the MADV_SOFT_OFFLINE case.

Thank you.

> btw, MADV_SOFT_OFFLINE and MADV_HWPOISON are not documented in that
> comment block over sys_madvise().  Fixy please?  You might want to
> check that no other MADV_foo values have been omitted.

OK, I posted the fix patch just now, which also updates about some other
madvices.

Thanks,
Naoya Horiguchi

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


#1318971 — Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace

FromVlastimil Babka <vbabka@suse.cz>
Date2016-01-27 15:00 +0100
SubjectRe: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace
Message-ID<qVyNA-4jj-5@gated-at.bofh.it>
In reply to#1314827
[CC += linux-api, linux-man]

On 01/22/2016 09:27 AM, Naoya Horiguchi wrote:
> Currently the return value of memory_failure() is not passed to userspace, which
> is inconvenient for test programs that want to know the result of error handling.
> So let's return it to the caller as we already do in MADV_SOFT_OFFLINE case.
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> ---
>  mm/madvise.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git v4.4-mmotm-2016-01-20-16-10/mm/madvise.c v4.4-mmotm-2016-01-20-16-10_patched/mm/madvise.c
> index f56825b..6a77114 100644
> --- v4.4-mmotm-2016-01-20-16-10/mm/madvise.c
> +++ v4.4-mmotm-2016-01-20-16-10_patched/mm/madvise.c
> @@ -555,8 +555,9 @@ static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end)
>  		}
>  		pr_info("Injecting memory failure for page %#lx at %#lx\n",
>  		       page_to_pfn(p), start);
> -		/* Ignore return value for now */
> -		memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED);
> +		ret = memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED);
> +		if (ret)
> +			return ret;

Can you explain what madvise can newly return for MADV_HWPOISON in which
situations, for the purposes of updated man page?

Thanks,
Vlastimil

>  	}
>  	return 0;
>  }
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web