From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752444AbcAVI2I (ORCPT ); Fri, 22 Jan 2016 03:28:08 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36555 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbcAVI2A (ORCPT ); Fri, 22 Jan 2016 03:28:00 -0500 From: Naoya Horiguchi To: Andrew Morton Cc: Chen Gong , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Naoya Horiguchi , Naoya Horiguchi Subject: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace Date: Fri, 22 Jan 2016 17:27:57 +0900 Message-Id: <1453451277-20979-1-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f175.google.com (mail-pf0-f175.google.com [209.85.192.175]) by kanga.kvack.org (Postfix) with ESMTP id 5F66F6B0005 for ; Fri, 22 Jan 2016 03:28:01 -0500 (EST) Received: by mail-pf0-f175.google.com with SMTP id q63so39547352pfb.1 for ; Fri, 22 Jan 2016 00:28:01 -0800 (PST) Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com. [2607:f8b0:400e:c00::241]) by mx.google.com with ESMTPS id oz1si8120685pac.46.2016.01.22.00.28.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jan 2016 00:28:00 -0800 (PST) Received: by mail-pf0-x241.google.com with SMTP id e65so3000937pfe.0 for ; Fri, 22 Jan 2016 00:28:00 -0800 (PST) From: Naoya Horiguchi Subject: [PATCH v1] mm/madvise: pass return code of memory_failure() to userspace Date: Fri, 22 Jan 2016 17:27:57 +0900 Message-Id: <1453451277-20979-1-git-send-email-n-horiguchi@ah.jp.nec.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Chen Gong , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Naoya Horiguchi , Naoya Horiguchi 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 --- 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 -- 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: email@kvack.org