linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Chen Gong <gong.chen@linux.intel.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	Linux API <linux-api@vger.kernel.org>,
	"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>,
	Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace
Date: Thu, 28 Jan 2016 05:49:11 +0000	[thread overview]
Message-ID: <20160128054910.GA5512@hori1.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <56A8CD2F.5080903@suse.cz>

On Wed, Jan 27, 2016 at 02:59:11PM +0100, Vlastimil Babka wrote:
> [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?

OK, this patch newly allows madvise(MADV_HWPOISON) to return EBUSY when
error handling failed due to 2 major reasons:
 - the target page is a page type which memory error handler doesn't support
   (like slab pages, kernel-reserved pages)
 - the memory error handler failed to isolate the target page (for example,
   due to failure in unmapping)

And for man page purpose, errnos of MADV_SOFT_OFFLINE is not documented either.
So let me refer to 2 possible error code from madvise(MADV_SOFT_OFFLINE):
 - EBUSY: failed to isolate from lru list,
 - EIO: failed to migrate the target page to another page.

Thanks,
Naoya Horiguchi
--
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>

      reply	other threads:[~2016-01-28  5:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22  8:27 Naoya Horiguchi
2016-01-26 23:27 ` Andrew Morton
2016-01-27  1:26   ` Naoya Horiguchi
2016-01-27 13:59 ` Vlastimil Babka
2016-01-28  5:49   ` Naoya Horiguchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160128054910.GA5512@hori1.linux.bs1.fc.nec.co.jp \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=gong.chen@linux.intel.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtk.manpages@gmail.com \
    --cc=nao.horiguchi@gmail.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox