Received: by 2002:a17:90a:37e8:0:0:0:0 with SMTP id v95csp4244070pjb; Mon, 21 Oct 2019 02:22:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgUzaLoXmU6g2HmrQ3C5OVZgEM4OYjok3PFZMPSDuPntUSLnHFmgf/tESaRbMt+YTSBpbf X-Received: by 2002:a05:6402:2d2:: with SMTP id b18mr23771697edx.264.1571649731861; Mon, 21 Oct 2019 02:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571649731; cv=none; d=google.com; s=arc-20160816; b=POLi9Ypq2fsEGGOr8/ItKW0ssjNoroKM3FuOAvCziccup7uVPR/LKcNqvpLry2DzLQ lJ4KhEsMvs5iW7uVyPgEjtbu+pUSvoOIFsGPNa2W9tB9Hfa5gEGvHkkRf300bpnHfk14 VdBSlMY1BwaZqxlZtVfFttXgjbN0h6UUZVCCjhNzEw8ok4LAk+Zat2eUzhyzJ3FdYaFi VMXeIFjn4/vubE7dPx17gpcIB2Tw/VCSj6qHcsE/7Tm81hrPvDXtIJ0yAujM2lRXIusj vvtUxkM0ggAVW6+MNRvszOcgXkd68hMgzzOqDZXhE0uJ0M1azrwMyLtOL12oLgjVAp5L 9ztw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from; bh=0YFjXtvJYoaDGwDOhLpYHDiNU4CUXENArXN0kxft6cI=; b=TfEubx4GmE3ka0k2SfayvO1Ldk7/ECUBrEmPP1+UTJNpCU+M3OFnLN1sKXsUvSZ8VD m/ucyPbDvgkiKuxDzvFRrs5wNZMQJIuoki+V8h75Y7DEpKnDyt8mPTtNWj94cSY37q8S pp/nZ0LyJt+uxrVcoMu8qyDCJ5rw55tpEgCkMijy/wRy62rLlQOrKcJm97hywKySrMRy +wvFHyjNFY5nTRzfs7SZsFyobzBLw+OFGOim1tIp11AnlQ19OCho/JAAXKJcf1y0hVGx 3S14cc32Y20EbjxUSr3Mr32yq7AH0XP00u9gWfOsj1Nb1T5XApE3EP0ZXB46FunLbZNm wncQ== 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 v27si8168936ejb.182.2019.10.21.02.21.48; Mon, 21 Oct 2019 02:22:11 -0700 (PDT) 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 S1727498AbfJUJVm convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Oct 2019 05:21:42 -0400 Received: from tyo162.gate.nec.co.jp ([114.179.232.162]:52023 "EHLO tyo162.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbfJUJVl (ORCPT ); Mon, 21 Oct 2019 05:21:41 -0400 Received: from mailgate01.nec.co.jp ([114.179.233.122]) by tyo162.gate.nec.co.jp (8.15.1/8.15.1) with ESMTPS id x9L9LP3H000336 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2019 18:21:25 +0900 Received: from mailsv01.nec.co.jp (mailgate-v.nec.co.jp [10.204.236.94]) by mailgate01.nec.co.jp (8.15.1/8.15.1) with ESMTP id x9L9LPT4031056; Mon, 21 Oct 2019 18:21:25 +0900 Received: from mail01b.kamome.nec.co.jp (mail01b.kamome.nec.co.jp [10.25.43.2]) by mailsv01.nec.co.jp (8.15.1/8.15.1) with ESMTP id x9L9LNXx028916; Mon, 21 Oct 2019 18:21:25 +0900 Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.152] [10.38.151.152]) by mail03.kamome.nec.co.jp with ESMTP id BT-MMP-84056; Mon, 21 Oct 2019 18:20:47 +0900 Received: from BPXM23GP.gisp.nec.co.jp ([10.38.151.215]) by BPXC24GP.gisp.nec.co.jp ([10.38.151.152]) with mapi id 14.03.0439.000; Mon, 21 Oct 2019 18:20:46 +0900 From: Naoya Horiguchi To: Oscar Salvador CC: "mhocko@kernel.org" , "mike.kravetz@oracle.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH v2 14/16] mm,hwpoison: Return 0 if the page is already poisoned in soft-offline Thread-Topic: [RFC PATCH v2 14/16] mm,hwpoison: Return 0 if the page is already poisoned in soft-offline Thread-Index: AQHVhPYyXKqj3nxce0SU95ZyoSgHHadkQNcA Date: Mon, 21 Oct 2019 09:20:46 +0000 Message-ID: <20191021092046.GA19876@hori.linux.bs1.fc.nec.co.jp> References: <20191017142123.24245-1-osalvador@suse.de> <20191017142123.24245-15-osalvador@suse.de> In-Reply-To: <20191017142123.24245-15-osalvador@suse.de> Accept-Language: en-US, ja-JP Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.34.125.96] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <5C2CE62D02FF7C4CA6ACEE42D9FC5D3F@gisp.nec.co.jp> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 17, 2019 at 04:21:21PM +0200, Oscar Salvador wrote: > Currently, there is an inconsistency when calling soft-offline from > different paths on a page that is already poisoned. > > 1) madvise: > > madvise_inject_error skips any poisoned page and continues > the loop. > If that was the only page to madvise, it returns 0. > > 2) /sys/devices/system/memory/: > > Whe calling soft_offline_page_store()->soft_offline_page(), > we return -EBUSY in case the page is already poisoned. > This is inconsistent with a) the above example and b) > memory_failure, where we return 0 if the page was poisoned. > > Fix this by dropping the PageHWPoison() check in madvise_inject_error, > and let soft_offline_page return 0 if it finds the page already poisoned. > > Please, note that this represents an user-api change, since now the return > error when calling soft_offline_page_store()->soft_offline_page() will be different. > > Signed-off-by: Oscar Salvador Looks good to me. Acked-by: Naoya Horiguchi > --- > mm/madvise.c | 3 --- > mm/memory-failure.c | 4 ++-- > 2 files changed, 2 insertions(+), 5 deletions(-) > > diff --git a/mm/madvise.c b/mm/madvise.c > index 8a0b1f901d72..9ca48345ce45 100644 > --- a/mm/madvise.c > +++ b/mm/madvise.c > @@ -887,9 +887,6 @@ static int madvise_inject_error(int behavior, > */ > put_page(page); > > - if (PageHWPoison(page)) > - continue; > - > if (behavior == MADV_SOFT_OFFLINE) { > pr_info("Soft offlining pfn %#lx at process virtual address %#lx\n", > pfn, start); > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 3d491c0d3f91..c038896bedf0 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -1767,7 +1767,7 @@ static int __soft_offline_page(struct page *page) > unlock_page(page); > put_page(page); > pr_info("soft offline: %#lx page already poisoned\n", pfn); > - return -EBUSY; > + return 0; > } > > if (!PageHuge(page)) > @@ -1866,7 +1866,7 @@ int soft_offline_page(struct page *page) > > if (PageHWPoison(page)) { > pr_info("soft offline: %#lx page already poisoned\n", pfn); > - return -EBUSY; > + return 0; > } > > get_online_mems(); > -- > 2.12.3 > >