Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp587679imu; Fri, 9 Nov 2018 02:48:54 -0800 (PST) X-Google-Smtp-Source: AJdET5fhjybjxgC4zBZVT6Ii0al8/L4WZ7mc4EVlhNowHV6TLYTmvnkaA1+cRrTTYaHO4QG5unh4 X-Received: by 2002:a63:ff62:: with SMTP id s34mr7004322pgk.325.1541760534150; Fri, 09 Nov 2018 02:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541760534; cv=none; d=google.com; s=arc-20160816; b=JnTywCWWXVRECHEv5jUcl3WqkgQJibjh2LIch7+UBm7A4VV9MMaomxshnBDFlZnfHC TDHo1Nfa3JP7ssJVZyF+uyH9jlgD2eqvgz+YpMZdy+E9RjMF5l5gXvlX7e3YmxMMrEQR 1Ps/1oSFBki1AFLpFXnexKmHFgH8yXy3ebaezQ/peRj6SwNwVvJLZmtgfDD7fWnwgKw9 sY7jsHK7Zzg7YwvlUX5KQ/j1sj0cvGOl5HdwWIPYtku9t7+cohZ2Q4+5g06vw/iu4Piy /m3ggqLIC+Us+0AXVdJGTfyL98INiFugaNPENb51WvDjvig7rSbjf5/pOTrJc+yeF7AD ZodQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ocgSM3ZbCDDXUZQsWPpWQUbjyt7dfiG4KOrFMmo+p50=; b=BTG2h2MQeTnlVC2XQGaeH8gMwXXxgJdoXVnL4APcERnyvLRFHh/zM/IhsFkRjL+HZt 4YVf2x9+3JLhnh3gnIYBX6fDb//z/dDMmsIXEv0BAZXat4gyfVI4/ysdqgpIsLgGhaS2 j8V7357CsOf/KyMUskiBWnNAoNpqVS1uVtHMEaqZYZ11iF/I8Rn0riJ/3cEg5ODHhHu0 XVqzwcLKsAyEuSp80/hZ4OpNwJAnRVwrvJZoZXMvSMrXTUAJRX6ngxDHTO5d937MOoyL 75GdwvJIdKEI1cnQpKYCsKmUx6UUstxv5V4sMe4hbAi2DZaaZbKHhLcYJeLsevi0F0LE m4Zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17-v6si6610635pls.302.2018.11.09.02.48.38; Fri, 09 Nov 2018 02:48:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728222AbeKIU1E (ORCPT + 99 others); Fri, 9 Nov 2018 15:27:04 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57072 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727532AbeKIU1D (ORCPT ); Fri, 9 Nov 2018 15:27:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 68978A78; Fri, 9 Nov 2018 02:47:00 -0800 (PST) Received: from [10.162.0.72] (p8cg001049571a15.blr.arm.com [10.162.0.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 258723F718; Fri, 9 Nov 2018 02:46:57 -0800 (PST) Subject: Re: [RFC][PATCH v1 04/11] mm: madvise: call soft_offline_page() without MF_COUNT_INCREASED To: Naoya Horiguchi , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Michal Hocko , Andrew Morton , Mike Kravetz , xishi.qiuxishi@alibaba-inc.com, Laurent Dufour References: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1541746035-13408-5-git-send-email-n-horiguchi@ah.jp.nec.com> From: Anshuman Khandual Message-ID: <21e5b9ca-ad72-b0d5-3397-4b65831b236b@arm.com> Date: Fri, 9 Nov 2018 16:16:55 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1541746035-13408-5-git-send-email-n-horiguchi@ah.jp.nec.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/09/2018 12:17 PM, Naoya Horiguchi wrote: > Currently madvise_inject_error() pins the target page when calling > memory error handler, but it's not good because the refcount is just > an artifact of error injector and mock nothing about hw error itself. > IOW, pinning the error page is part of error handler's task, so > let's stop doing it. Did not get that. Could you please kindly explain how an incremented ref count through get_user_pages_fast() was a mocking the HW error previously ? Though I might be missing the some context here. > > Signed-off-by: Naoya Horiguchi > --- > mm/madvise.c | 25 +++++++++++-------------- > 1 file changed, 11 insertions(+), 14 deletions(-) > > diff --git v4.19-mmotm-2018-10-30-16-08/mm/madvise.c v4.19-mmotm-2018-10-30-16-08_patched/mm/madvise.c > index 6cb1ca9..9fa0225 100644 > --- v4.19-mmotm-2018-10-30-16-08/mm/madvise.c > +++ v4.19-mmotm-2018-10-30-16-08_patched/mm/madvise.c > @@ -637,6 +637,16 @@ static int madvise_inject_error(int behavior, > ret = get_user_pages_fast(start, 1, 0, &page); > if (ret != 1) > return ret; > + /* > + * The get_user_pages_fast() is just to get the pfn of the > + * given address, and the refcount has nothing to do with > + * what we try to test, so it should be released immediately. > + * This is racy but it's intended because the real hardware > + * errors could happen at any moment and memory error handlers > + * must properly handle the race. > + */ > + put_page(page); > + > pfn = page_to_pfn(page); > > /* > @@ -646,16 +656,11 @@ static int madvise_inject_error(int behavior, > */ > order = compound_order(compound_head(page)); > > - if (PageHWPoison(page)) { > - put_page(page); > - continue; > - } > - > if (behavior == MADV_SOFT_OFFLINE) { > pr_info("Soft offlining pfn %#lx at process virtual address %#lx\n", > pfn, start); > > - ret = soft_offline_page(page, MF_COUNT_INCREASED); > + ret = soft_offline_page(page, 0); Probably something defined as a new "ignored" in the memory faults flag enumeration instead of passing '0' directly.