Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4787157imu; Mon, 12 Nov 2018 17:34:15 -0800 (PST) X-Google-Smtp-Source: AJdET5fbkOO9ekPJXK/SqqqLSjbL84DxVQ2ZOB1OVtn5P5UqnFX2fBkFObdPvGCHlC7USdQw0v3a X-Received: by 2002:a17:902:bb0a:: with SMTP id l10-v6mr3190929pls.230.1542072855599; Mon, 12 Nov 2018 17:34:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542072855; cv=none; d=google.com; s=arc-20160816; b=AHqf0Rxxq2az9/8lNJq9hWlZOGX//WkNV4SwXDGxd/tvMnbwB9V91w5Va22Y26hTE4 xCZnaXvjFk5efTvtlrIfxNYLFCwYafg4Gnq5WzQgWQMYttCKjFi/AvFovBhnCO+y/R5f WMQtFVKeoQgzbIpXrZ/Q2TEGxO5hfA/qnRq6+UQ7/lgKyHDSzWWzggy5HYf6bcATduH7 SP0ZS2S4zPCqnRorpDOcOuoIKlxvSqytSj7j0opcuhhf3VDl1Ta0L9Wn+LKYP26QjC8+ lLaRgCb4uurW1g7ggYSVvmvJvoPfYvTsbyb6xxm3fnZ/ph9iX1psFL+9KvMAxK5CvajJ GAEQ== 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=nseqzlPwqhlmA2t82dZamdDQBl3gLjdg+acDOG1PpGU=; b=Hh5fMRHzTsg0P+72z6fu1RoFpFrPECjfqR3FUhtfKTXvfHKUI/yPI82A+ytgcXBPkC Y6E+wF5DHwqX5IuAckVcZpVxqbnDXW/DY9wrZvDZELP2YU5wVunubR1bf5Ibd57CHTlc 2bvIa5sHDAEXy/SH4fxcsPWpVrF7DJp82w5SavjWZIMFDOHMBeVSBS8/nIX/UboamfBU b4N1SZ6hzAfy3lYadvjFhjLasiJkJwiY7CJ8k2RFLr56bQhS2DsL8A2sBP3Id9zSWiO+ O6GvS4t9CvPFHWmb+CPZzh7Ad3WQl7vR4TQpK/CsDbLz1bTXO/Tt8tGilBkEq1FtUQfQ dZ1g== 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 h80-v6si16367623pfj.112.2018.11.12.17.33.58; Mon, 12 Nov 2018 17:34:15 -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 S1729324AbeKML3V convert rfc822-to-8bit (ORCPT + 99 others); Tue, 13 Nov 2018 06:29:21 -0500 Received: from tyo161.gate.nec.co.jp ([114.179.232.161]:55948 "EHLO tyo161.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbeKML3V (ORCPT ); Tue, 13 Nov 2018 06:29:21 -0500 Received: from mailgate02.nec.co.jp ([114.179.233.122]) by tyo161.gate.nec.co.jp (8.15.1/8.15.1) with ESMTPS id wAD1XIrD009934 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 13 Nov 2018 10:33:18 +0900 Received: from mailsv02.nec.co.jp (mailgate-v.nec.co.jp [10.204.236.94]) by mailgate02.nec.co.jp (8.15.1/8.15.1) with ESMTP id wAD1XIA9012740; Tue, 13 Nov 2018 10:33:18 +0900 Received: from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5]) by mailsv02.nec.co.jp (8.15.1/8.15.1) with ESMTP id wAD1URDa020044; Tue, 13 Nov 2018 10:33:18 +0900 Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.152] [10.38.151.152]) by mail01b.kamome.nec.co.jp with ESMTP id BT-MMP-5449202; Tue, 13 Nov 2018 10:32:16 +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.0319.002; Tue, 13 Nov 2018 10:32:15 +0900 From: Naoya Horiguchi To: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" CC: Michal Hocko , Andrew Morton , Mike Kravetz , "xishi.qiuxishi@alibaba-inc.com" , "Laurent Dufour" Subject: Re: [RFC][PATCH v1 10/11] mm: clear PageHWPoison in memory hotremove Thread-Topic: [RFC][PATCH v1 10/11] mm: clear PageHWPoison in memory hotremove Thread-Index: AQHUevC1WE7Ov12NQki9D02l1L5ksg== Date: Tue, 13 Nov 2018 01:32:15 +0000 Message-ID: <20181113013214.GA14528@hori1.linux.bs1.fc.nec.co.jp> References: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com> <1541746035-13408-11-git-send-email-n-horiguchi@ah.jp.nec.com> In-Reply-To: <1541746035-13408-11-git-send-email-n-horiguchi@ah.jp.nec.com> Accept-Language: en-US, ja-JP Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.51.8.80] Content-Type: text/plain; charset="iso-2022-jp" Content-ID: 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 Fri, Nov 09, 2018 at 03:47:14PM +0900, Naoya Horiguchi wrote: > One hopeful usecase of memory hotplug is to replace half-broken DIMMs > with new ones, so it makes sense to clear hwpoison info at the time of > memory hotremove. > > I hope that this patch covers the topic discussed in > https://lkml.org/lkml/2018/1/17/1228 > > Signed-off-by: Naoya Horiguchi > --- > mm/page_alloc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git v4.19-mmotm-2018-10-30-16-08/mm/page_alloc.c v4.19-mmotm-2018-10-30-16-08_patched/mm/page_alloc.c > index 970d6ff..27826b3 100644 > --- v4.19-mmotm-2018-10-30-16-08/mm/page_alloc.c > +++ v4.19-mmotm-2018-10-30-16-08_patched/mm/page_alloc.c > @@ -8139,8 +8139,9 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn) > * The HWPoisoned page may be not in buddy system, and > * page_count() is not 0. > */ > - if (unlikely(!PageBuddy(page) && PageHWPoison(page))) { > + if (unlikely(!PageBuddy(page) && TestClearPageHWPoison(page))) { > pfn++; > + num_poisoned_pages_dec(); > SetPageReserved(page); > continue; > } Kbuild test robot shows that this patch causes build errors on !CONFIG_MEMORY_FAILURE, which should be fixed by the following changes. Thanks, Naoya Horiguchi --- diff --git a/include/linux/mm.h b/include/linux/mm.h index 6c496dab246d..559092915fe6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2785,6 +2785,10 @@ static inline void num_poisoned_pages_dec(void) { atomic_long_dec(&num_poisoned_pages); } +#else +static inline void num_poisoned_pages_dec(void) +{ +} #endif #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index ab0bde073050..1461384aa1a3 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -385,6 +385,7 @@ extern bool set_hwpoison_free_buddy_page(struct page *page); extern bool clear_hwpoison_free_buddy_page(struct page *page); #else PAGEFLAG_FALSE(HWPoison) +TESTCLEARFLAG_FALSE(HWPoison) static inline bool set_hwpoison_free_buddy_page(struct page *page) { return false;