Skip to content

Commit

Permalink
mm/madvise: pass return code of memory_failure() to userspace
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Naoya Horiguchi authored and Linus Torvalds committed Mar 15, 2016
1 parent 5b3810e commit 23a003b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 23a003b

Please sign in to comment.