From patchwork Mon Oct 21 09:51:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11201709 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A4ECD13B1 for ; Mon, 21 Oct 2019 09:51:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71A0B214AE for ; Mon, 21 Oct 2019 09:51:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71A0B214AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B13656B0006; Mon, 21 Oct 2019 05:51:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AC3B66B0007; Mon, 21 Oct 2019 05:51:14 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B2006B0008; Mon, 21 Oct 2019 05:51:14 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 7A9636B0006 for ; Mon, 21 Oct 2019 05:51:14 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 07E27181AC9CC for ; Mon, 21 Oct 2019 09:51:14 +0000 (UTC) X-FDA: 76067323668.17.tax84_44e2c1345f713 X-Spam-Summary: 2,0,0,62ecedfc2616d5c0,d41d8cd98f00b204,nao.horiguchi@gmail.com,:n-horiguchi@ah.jp.nec.com:osalvador@suse.de:mhocko@kernel.org:mike.kravetz@oracle.com::linux-kernel@vger.kernel.org,RULES_HIT:41:355:379:800:960:966:973:979:988:989:1260:1277:1312:1313:1314:1345:1359:1437:1516:1518:1519:1535:1544:1593:1594:1595:1596:1605:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2899:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:4362:4383:4385:4395:4605:5007:6119:6227:6261:6611:7576:7903:8660:8957:9413:9545:10004:10399:10967:11026:11232:11473:11658:11914:12043:12262:12297:12438:12555:12679:12740:12895:12986:13148:13163:13229:13230:13895:14093:14097:14181:14394:14687:14721:21060:21080:21094:21212:21323:21324:21450:21451:21627:21666:30012:30054:30064:30090:30091,0,RBL:153.121.56.200:@gmail.com:.lbl8.mailshell.net-62.22.10.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fu,MSBL:0,DN SBL:neut X-HE-Tag: tax84_44e2c1345f713 X-Filterd-Recvd-Size: 5297 Received: from www9186uo.sakura.ne.jp (www9186uo.sakura.ne.jp [153.121.56.200]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Oct 2019 09:51:13 +0000 (UTC) Received: by www9186uo.sakura.ne.jp (Postfix, from userid 500) id 4F87B1E10EA; Mon, 21 Oct 2019 18:51:09 +0900 (JST) Date: Mon, 21 Oct 2019 18:51:09 +0900 From: Naoya Horiguchi To: Naoya Horiguchi Cc: Oscar Salvador , "mhocko@kernel.org" , "mike.kravetz@oracle.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH 17/16] mm,hwpoison: introduce MF_MSG_UNSPLIT_THP Message-ID: <20191021095106.GA22933@www9186uo.sakura.ne.jp> References: <20191017142123.24245-1-osalvador@suse.de> <20191017142123.24245-10-osalvador@suse.de> <20191021070439.GC9037@hori.linux.bs1.fc.nec.co.jp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191021070439.GC9037@hori.linux.bs1.fc.nec.co.jp> User-Agent: Mutt/1.5.20 (2009-12-10) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Oct 21, 2019 at 07:04:40AM +0000, Naoya Horiguchi wrote: > On Thu, Oct 17, 2019 at 04:21:16PM +0200, Oscar Salvador wrote: > > Place the THP's page handling in a helper and use it > > from both hard and soft-offline machinery, so we get rid > > of some duplicated code. > > > > Signed-off-by: Oscar Salvador ... > > @@ -1288,21 +1307,8 @@ int memory_failure(unsigned long pfn, int flags) > > } > > > > if (PageTransHuge(hpage)) { > > - lock_page(p); > > - if (!PageAnon(p) || unlikely(split_huge_page(p))) { > > - unlock_page(p); > > - if (!PageAnon(p)) > > - pr_err("Memory failure: %#lx: non anonymous thp\n", > > - pfn); > > - else > > - pr_err("Memory failure: %#lx: thp split failed\n", > > - pfn); > > - if (TestClearPageHWPoison(p)) > > - num_poisoned_pages_dec(); > > - put_page(p); > > + if (try_to_split_thp_page(p, "Memory Failure") < 0) > > return -EBUSY; > > Although this is not a cleanup thing, this failure path means that > hwpoison is handled (PG_hwpoison is marked), so action_result() should > be called. I'll add a patch for this later. Here's the one. So Oscar, If you like, could you append this to your tree in the next spin (with your credit or signed-off-by)? Thanks, Naoya Horiguchi --- From b920f965485f6679ddc27e1a51da5bff7a5cc81a Mon Sep 17 00:00:00 2001 From: Naoya Horiguchi Date: Mon, 21 Oct 2019 18:42:33 +0900 Subject: [PATCH] mm,hwpoison: introduce MF_MSG_UNSPLIT_THP memory_failure() is supposed to call action_result() when it handles a memory error event, but there's one missing case. So let's add it. I find that include/ras/ras_event.h has some other MF_MSG_* undefined, so this patch also adds them. Signed-off-by: Naoya Horiguchi --- include/linux/mm.h | 1 + include/ras/ras_event.h | 3 +++ mm/memory-failure.c | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 3eba26324ff1..022033cc6782 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2818,6 +2818,7 @@ enum mf_action_page_type { MF_MSG_BUDDY, MF_MSG_BUDDY_2ND, MF_MSG_DAX, + MF_MSG_UNSPLIT_THP, MF_MSG_UNKNOWN, }; diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h index 36c5c5e38c1d..0bdbc0d17d2f 100644 --- a/include/ras/ras_event.h +++ b/include/ras/ras_event.h @@ -361,6 +361,7 @@ TRACE_EVENT(aer_event, EM ( MF_MSG_POISONED_HUGE, "huge page already hardware poisoned" ) \ EM ( MF_MSG_HUGE, "huge page" ) \ EM ( MF_MSG_FREE_HUGE, "free huge page" ) \ + EM ( MF_MSG_NON_PMD_HUGE, "non-pmd-sized huge page" ) \ EM ( MF_MSG_UNMAP_FAILED, "unmapping failed page" ) \ EM ( MF_MSG_DIRTY_SWAPCACHE, "dirty swapcache page" ) \ EM ( MF_MSG_CLEAN_SWAPCACHE, "clean swapcache page" ) \ @@ -373,6 +374,8 @@ TRACE_EVENT(aer_event, EM ( MF_MSG_TRUNCATED_LRU, "already truncated LRU page" ) \ EM ( MF_MSG_BUDDY, "free buddy page" ) \ EM ( MF_MSG_BUDDY_2ND, "free buddy page (2nd try)" ) \ + EM ( MF_MSG_DAX, "dax page" ) \ + EM ( MF_MSG_UNSPLIT_THP, "unsplit thp" ) \ EMe ( MF_MSG_UNKNOWN, "unknown page" ) /* diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 46ca856703f6..b15086ad8948 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -583,6 +583,7 @@ static const char * const action_page_types[] = { [MF_MSG_BUDDY] = "free buddy page", [MF_MSG_BUDDY_2ND] = "free buddy page (2nd try)", [MF_MSG_DAX] = "dax page", + [MF_MSG_UNSPLIT_THP] = "unsplit thp", [MF_MSG_UNKNOWN] = "unknown page", }; @@ -1361,8 +1362,10 @@ int memory_failure(unsigned long pfn, int flags) } if (PageTransHuge(hpage)) { - if (try_to_split_thp_page(p, "Memory Failure") < 0) + if (try_to_split_thp_page(p, "Memory Failure") < 0) { + action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED); return -EBUSY; + } VM_BUG_ON_PAGE(!page_count(p), p); hpage = compound_head(p); }