From patchwork Thu Aug 6 18:49:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704085 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 A65E6913 for ; Thu, 6 Aug 2020 18:49:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D893922D73 for ; Thu, 6 Aug 2020 18:49:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KOXH41yn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D893922D73 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 5E80E6B0003; Thu, 6 Aug 2020 14:49:34 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 599C76B0005; Thu, 6 Aug 2020 14:49:34 -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 4610E6B0007; Thu, 6 Aug 2020 14:49:34 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id 31FF46B0003 for ; Thu, 6 Aug 2020 14:49:34 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EB940181AEF10 for ; Thu, 6 Aug 2020 18:49:33 +0000 (UTC) X-FDA: 77121032226.07.baby80_2a0bfa826fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id C476B1803FFC1 for ; Thu, 6 Aug 2020 18:49:33 +0000 (UTC) X-Spam-Summary: 1,0,0,61f9c3cfe9335b0f,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:355:379:541:800:960:968:973:981:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2899:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:4321:5007:6261:6653:6742:7576:8957:9413:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12740:12895:13069:13311:13357:14096:14181:14384:14394:14721:21060:21080:21222:21444:21627:21666:22119:30012:30046:30054:30064:30070:30079,0,RBL:209.85.214.196:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04y8e56b5eemgb8t3twwfpn61uhi6opdwtax7s65ikqi37pg5kiabxmcwiyh9ri.4pati96mrt7cmom43bxrncxagga88hk3oqa4mqyitbqbytbc67ktd6r4t18gq95.1-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none X-HE-Tag: baby80_2a0bfa826fb9 X-Filterd-Recvd-Size: 4337 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:33 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id r4so17606970pls.2 for ; Thu, 06 Aug 2020 11:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pS0WhU6WE8IYcQCnD1IwwP5QRHOYUjKqdATKfccEtHE=; b=KOXH41ynmycekcDeMi9gZeiIS5eCKt3SCoMwlCTMHjb0JpMnOqc3vJoLKZfbX8BXQr +3PK+ex/1iKo64nx4cSsOP5WPAwB0IyatsYFDCoO+55h81UKK7NZaFiMcBxxzHrqQxBk Xs5oyToQ2QSy0+wGe2oHcxlBRe6wC+noBPy0KvzKOif6UfoF/BnNskrZ6PkmxeCtEB0a 3sNMPnigY0YoWJ749k7h6SGS/vlxyKNNSnoET7InWc8gdyT18CjBAOX5TVmkR3LbRAr0 Od0zuuJVaeIfNMukviws18DKLGd0vHBywboPjulRboLJswDBKsJbiHDasQ8Ev/SeRSBH RuIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pS0WhU6WE8IYcQCnD1IwwP5QRHOYUjKqdATKfccEtHE=; b=sWNrtTRDSBrvWHzm4+ORAJeJ1lIdCHW74nycrH2hRdadbg1TxkZWYaS0fz5ijhqA96 7nKI1WVsu6goufOZe7NylWhXzxTE1fT+LdeJL+io/SmysYCtbWczxVUKFAYXWUIZq7Vv nJmbgUhIIaQi0Z29dCSuDeZevCHXHcLF+MiKlbpcBOLKhJiOX7LiC4S3DZUMBPptw05p eSvaG1KFnQZL8rF2eqvQLtcVrHxQnjAHsjsjgCay79/sCq2qBnqfMZLPr/lwFqmjtVOe Qe2YIcYwKvit4PiaSjzIlUMQp5moFtspmKlLWxT5M1pt3Yr410rf1HkZV8s1gjNdRQ9M 3BTQ== X-Gm-Message-State: AOAM533PnKwL3hw/ecEaaEYn8Xe9eMu/RIOD78pe62txz2gIX6f4tFfe iYT5aM6IwcuJhB8F0zAQVAXnsWGiLQ== X-Google-Smtp-Source: ABdhPJyxuBozs6QXnWSecAuONMVWxvd4dNJdBV1f4bZFBqG27ANykG47lkr6oIrXUy60PoNvNI93sw== X-Received: by 2002:a17:902:bb82:: with SMTP id m2mr8992381pls.115.1596739772043; Thu, 06 Aug 2020 11:49:32 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:31 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 01/12] mm,hwpoison: cleanup unused PageHuge() check Date: Thu, 6 Aug 2020 18:49:12 +0000 Message-Id: <20200806184923.7007-2-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: C476B1803FFC1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Naoya Horiguchi Drop the PageHuge check, which is dead code since memory_failure() forks into memory_failure_hugetlb() for hugetlb pages. memory_failure() and memory_failure_hugetlb() shares some functions like hwpoison_user_mappings() and identify_page_state(), so they should properly handle 4kB page, thp, and hugetlb. Signed-off-by: Naoya Horiguchi Signed-off-by: Oscar Salvador Reviewed-by: Mike Kravetz --- mm/memory-failure.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index fe53768e0793..3d2d61f1c6e9 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -1382,10 +1382,7 @@ int memory_failure(unsigned long pfn, int flags) * page_remove_rmap() in try_to_unmap_one(). So to determine page status * correctly, we save a copy of the page flags at this time. */ - if (PageHuge(p)) - page_flags = hpage->flags; - else - page_flags = p->flags; + page_flags = p->flags; /* * unpoison always clear PG_hwpoison inside page lock From patchwork Thu Aug 6 18:49:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704087 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 7899A913 for ; Thu, 6 Aug 2020 18:49:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A2BB922C9F for ; Thu, 6 Aug 2020 18:49:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dW+PgodN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2BB922C9F 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 461D86B0005; Thu, 6 Aug 2020 14:49:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4387B6B0007; Thu, 6 Aug 2020 14:49:37 -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 351966B0008; Thu, 6 Aug 2020 14:49:37 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 208936B0005 for ; Thu, 6 Aug 2020 14:49:37 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C29932C1F for ; Thu, 6 Aug 2020 18:49:36 +0000 (UTC) X-FDA: 77121032352.05.verse69_5d0154b26fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 92EA11801FA4E for ; Thu, 6 Aug 2020 18:49:36 +0000 (UTC) X-Spam-Summary: 1,0,0,469be48e7ebaa894,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1431:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2895:2899:3138:3139:3140:3141:3142:3352:3865:3866:3867:3870:3871:4321:5007:6119:6261:6653:6742:7576:7903:9413:10004:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12679:12740:12895:13069:13311:13357:14096:14181:14384:14394:14721:21060:21080:21444:21451:21627:21666:21795:22119:30051:30054:30064:30070,0,RBL:209.85.216.65:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yrjbkd4anwhgpbiw73cd47hfua1ypb3r63bkhr1u39sa9ichxy7dxjrfnxx6z.8z87abptc5rjm1a8tnbec11d1shp8icjn7qyc4kh3rhfpmi7b3dkq6qmfb8ctyt.w-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: verse69_5d0154b26fb9 X-Filterd-Recvd-Size: 4515 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:36 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id l60so7323887pjb.3 for ; Thu, 06 Aug 2020 11:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qrNOopevZrXOPbrUYdqc/luUXjhR4msmU2SD/x7wn8s=; b=dW+PgodNF48RAaGwGN8hRaeeIti0F2ClybxPtutZjQItbJoVlpQkZDO8YGZYhEI+3i 3TUAxO+QufKjTV1DjSHQMdIzHR8kNbkPiimWo01mkhkWReUmIT/MU9HROGCVkwsrcuCQ NbzIx8sAdB1hKjhQLcO8nVs/hnUfCR1P7oDITfdVwT4gebqg27MKuQrFurk9DxYw+8q+ B9SdiirdfpyLP+6gdCPpJmMyt1QnRfL6SD5QWWPmbHHMB/hV3Q0IF3UChhGl4/uvng9t fpix0/uSNL+B4TnzZpS4SGzg+es9VjEekHF7iDNSRgxqyXXFLkUgdvHbzw2wjAxwmmiz LkSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qrNOopevZrXOPbrUYdqc/luUXjhR4msmU2SD/x7wn8s=; b=gkk1rvaX0lbun+kgN1s4EQ0jBfP/CHXh0mc4vmIgrVkVbNGSFr9ncFtiUDpBvVJgGk 25yjQDfwK5XNE1NUJypjzfm78VJvKuJ/gYmlCrT3egTWlg2+KJKVbC7AOVeGUX/32y/m Ru7gPgaCweu9X/jl06EZtHimAYmcUkOpcU8S4k/tZGFcFJwiHPu+eyumnUqV8jXxVU+F 5Ks5Z2gjUADtG8dXW/517DwSCn6F12lAlRrY+iW+qaYRc7aOx08G6YP2g0ALu3trQVM3 xZVc0m5uP9ZEwmjs4vgAg+1gTo39/Moyehm86gIS7Ik5MCllQMrP/FhAONIqDnRIplzy MGyQ== X-Gm-Message-State: AOAM533W65n8/+2fGwQLsFL222kO3ZZ8itolaz50/F1RSU7Ug8YbIl1v wkSMFOZZL7O8kJlnRMr1OnYlnDXeEQ== X-Google-Smtp-Source: ABdhPJyGlRH9DZJICHEHHkgFtaCUSUovuGikU1NNYN8M6nMZv0PwUA/D0NIWAh5ptTVDgEknCjeFuw== X-Received: by 2002:a17:902:a50d:: with SMTP id s13mr9036876plq.135.1596739775259; Thu, 06 Aug 2020 11:49:35 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:34 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 02/12] mm, hwpoison: remove recalculating hpage Date: Thu, 6 Aug 2020 18:49:13 +0000 Message-Id: <20200806184923.7007-3-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 92EA11801FA4E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: From: Naoya Horiguchi hpage is never used after try_to_split_thp_page() in memory_failure(), so we don't have to update hpage. So let's not recalculate/use hpage. Suggested-by: "Aneesh Kumar K.V" Signed-off-by: Naoya Horiguchi Signed-off-by: Oscar Salvador Reviewed-by: Mike Kravetz --- mm/memory-failure.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 3d2d61f1c6e9..f8d200417e0f 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -1342,7 +1342,6 @@ int memory_failure(unsigned long pfn, int flags) } unlock_page(p); VM_BUG_ON_PAGE(!page_count(p), p); - hpage = compound_head(p); } /* @@ -1414,11 +1413,8 @@ int memory_failure(unsigned long pfn, int flags) /* * Now take care of user space mappings. * Abort on fail: __delete_from_page_cache() assumes unmapped page. - * - * When the raw error page is thp tail page, hpage points to the raw - * page after thp split. */ - if (!hwpoison_user_mappings(p, pfn, flags, &hpage)) { + if (!hwpoison_user_mappings(p, pfn, flags, &p)) { action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED); res = -EBUSY; goto out; From patchwork Thu Aug 6 18:49:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704089 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 7C726913 for ; Thu, 6 Aug 2020 18:49:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B0EBE22D06 for ; Thu, 6 Aug 2020 18:49:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ii2xA4EL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0EBE22D06 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 4FD866B0007; Thu, 6 Aug 2020 14:49:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4D4376B0008; Thu, 6 Aug 2020 14:49:41 -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 3EAF06B000A; Thu, 6 Aug 2020 14:49:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 299796B0007 for ; Thu, 6 Aug 2020 14:49:41 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C9F53180AD802 for ; Thu, 6 Aug 2020 18:49:40 +0000 (UTC) X-FDA: 77121032520.13.mind42_3b152d126fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 124C718140B70 for ; Thu, 6 Aug 2020 18:49:40 +0000 (UTC) X-Spam-Summary: 1,0,0,2ad27dbf0f68d8e6,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:69:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1541:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2693:2899:3138:3139:3140:3141:3142:3353:3865:3867:3872:3874:4321:4385:5007:6119:6261:6653:6742:7576:7903:8957:9413:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12740:12895:13069:13311:13357:14181:14384:14394:14721:21060:21080:21094:21323:21444:21451:21627:21666:21990:22119:30054:30070,0,RBL:209.85.210.195:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04y85ze3iuomka5z8zdp95z1rjihoyccbp5i7uyqe1m89uyxaqwk7t55gyckrjo.siykxgt343d1xbor5hegareoks9mdo8b1akrpw5ixuritegs3mz4aamgjszp9c6.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: mind42_3b152d126fb9 X-Filterd-Recvd-Size: 5002 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:39 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id r11so17686666pfl.11 for ; Thu, 06 Aug 2020 11:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D4Ndr3lMfGWryT8BpcCBWbkT9Sd7Lw+5S6mzuxOjqm0=; b=ii2xA4EL8TIMLWF54Dp2D3VhPKG3XgrAie0iACmR72fXffFW1cOxQX92MCI/lEdir7 aiWKHf1TWBOK6nX9AwY9weAMVgtlamS0j8rv0lEEpCYk8Sx9DtVaF04m+ex66WOfpLOW w+6j1GENJtWtRVPUlYXMuFjA5H93/0mYaVWDByZoRBN2uY/Ovzxc+qOzkh62Qgo5wTJZ 9RQF56vRmATSiMczuxW5M1A+M/jVjIBCavXVLmXSSu/L/45HZqZgDfj5CNuZdSz4sQ8X XMEBwWr+27vlQGN1mX3SakuCPv/Xv5RTbd6Weohxn5Fgksuq1k+mBNr6vnr7YwsN38MR M19Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D4Ndr3lMfGWryT8BpcCBWbkT9Sd7Lw+5S6mzuxOjqm0=; b=QbhUXATnMdupgWJK1Y67sgtqYDZzklDpDYx19s6/6xMde6PbHKkPpeTaDgTlOCdHs6 9kd51zxUIowcgB+KINL3b8GWZHatO8NoQmKbxt/JZ1foIIhlC0IkcRnNwBE7IX2ta1sI rzETWlO0gvoR/CnbC+Wk+30oSs5Ld2YYBLPYAuo59Epwp1/v4jDAQUuDcEnxM3scdTdN H7zxuhTQCRDb6zyljRCEQlIbp4sdwxhQ5Jk+iKuB2xLZ0OUAlUKkwP6UYVSa9lPWUI2M m3axw1ROz+zsSySItfzdaKdK4dJ/z5MQJ3JbYjXMQcnOEP6hrIl5nQYuJfMeHYx6wdDg NA+w== X-Gm-Message-State: AOAM531owhtg38axEl8Pk0AM8Ik/WplQ84To134PjDmHOLQJGDSC7Ihe NZOD0UVz3HvAw2E9TThZ61huDCrXGw== X-Google-Smtp-Source: ABdhPJxXtfyq9aAepqkzQN6GNB2RBi2ndAap+zkgx75ukc39JHhcIPD5iEbccXFxp9BhTTjZ+9wlLw== X-Received: by 2002:a63:7746:: with SMTP id s67mr8471318pgc.159.1596739778407; Thu, 06 Aug 2020 11:49:38 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:37 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 03/12] mm,hwpoison-inject: don't pin for hwpoison_filter Date: Thu, 6 Aug 2020 18:49:14 +0000 Message-Id: <20200806184923.7007-4-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 124C718140B70 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: From: Naoya Horiguchi Another memory error injection interface debugfs:hwpoison/corrupt-pfn also takes bogus refcount for hwpoison_filter(). It's justified because this does a coarse filter, expecting that memory_failure() redoes the check for sure. Signed-off-by: Naoya Horiguchi Signed-off-by: Oscar Salvador --- mm/hwpoison-inject.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/hwpoison-inject.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/hwpoison-inject.c index e488876b168a..1ae1ebc2b9b1 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/hwpoison-inject.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/hwpoison-inject.c @@ -26,11 +26,6 @@ static int hwpoison_inject(void *data, u64 val) p = pfn_to_page(pfn); hpage = compound_head(p); - /* - * This implies unable to support free buddy pages. - */ - if (!get_hwpoison_page(p)) - return 0; if (!hwpoison_filter_enable) goto inject; @@ -40,23 +35,20 @@ static int hwpoison_inject(void *data, u64 val) * This implies unable to support non-LRU pages. */ if (!PageLRU(hpage) && !PageHuge(p)) - goto put_out; + return 0; /* - * do a racy check with elevated page count, to make sure PG_hwpoison - * will only be set for the targeted owner (or on a free page). + * do a racy check to make sure PG_hwpoison will only be set for + * the targeted owner (or on a free page). * memory_failure() will redo the check reliably inside page lock. */ err = hwpoison_filter(hpage); if (err) - goto put_out; + return 0; inject: pr_info("Injecting memory failure at pfn %#lx\n", pfn); - return memory_failure(pfn, MF_COUNT_INCREASED); -put_out: - put_hwpoison_page(p); - return 0; + return memory_failure(pfn, 0); } static int hwpoison_unpoison(void *data, u64 val) From patchwork Thu Aug 6 18:49:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704091 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 438181510 for ; Thu, 6 Aug 2020 18:49:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6E1EF2224D for ; Thu, 6 Aug 2020 18:49:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HsPZzU08" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E1EF2224D 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 EC12B6B0008; Thu, 6 Aug 2020 14:49:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E987B6B000A; Thu, 6 Aug 2020 14:49:43 -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 DADDB6B000C; Thu, 6 Aug 2020 14:49:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id CB0786B0008 for ; Thu, 6 Aug 2020 14:49:43 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6261A2494 for ; Thu, 6 Aug 2020 18:49:43 +0000 (UTC) X-FDA: 77121032646.28.oil95_4c0808b26fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 135376C2F for ; Thu, 6 Aug 2020 18:49:43 +0000 (UTC) X-Spam-Summary: 1,0,0,171b564c8b5496b3,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:355:379:541:800:960:968:973:988:989:1260:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:2899:3138:3139:3140:3141:3142:3352:3865:3867:3868:3870:3871:3872:3874:4321:5007:6261:6653:6742:7576:9413:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12740:12895:13069:13311:13357:14096:14181:14384:14394:14721:21060:21080:21444:21451:21627:21666:21795:21990:22119:30012:30051:30054,0,RBL:209.85.216.68:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04ygwyrz9ra8cday7tu3q1kk4d17cop77r64gictir67xxmqrnci4tb19mmrms8.o94qwn4pzeft48y3ew414c5rnsxwrpqnbebr9jcux651o8gbc393imfg6djecbu.n-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: oil95_4c0808b26fb9 X-Filterd-Recvd-Size: 4971 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:42 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id e4so7332850pjd.0 for ; Thu, 06 Aug 2020 11:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CvFlC6ki86jyf2poLn8AnY/Z80LUaeq3pjN3kabbpGI=; b=HsPZzU08x/nUjZZL1blwT0m3W0a7waKc5rryRpUTlYyuMNj3Cvpx63kTV6peM+Ux95 R+3zUu8yMS1wP2EzY5la+PEhDuaVnLf007d7/G4lfpXIxcv/7GKV/1x8/U6wwO27veU8 lyhoy8kv4SXCmEX7ZBxOPgS3m9jqbVtXKFZ0XXMMV6R1rXj8Kl7W9yMnANgmCJm2H6rS LS6BCAQfcfEJj/Vv+UFoCh/zJKwmh3SMP/vz0dJPsfNlG85B1ynwYAPptiQTRMdlE+Yp vFBwfAPz+zn0JANdmuWAUPBFL+QhfNP8x1fsgyTWcY5JUOy3792gCQvl8WZVkMncn4h0 GIaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CvFlC6ki86jyf2poLn8AnY/Z80LUaeq3pjN3kabbpGI=; b=DpVVPAo3E40Em7uYtXC1RxhbEW9sVBVFml80PaS4Ff8siA6+FQ+8dcDNZsksNnt4VF S88cegWse7Q8kY7c8Y3nniygbPX4vaM0gl9D35OaZ4cR64JFu1nxoiYpICs7X8xJYb1B ojY37s09ikruGzg9Mgz9GzvE8g/14tI+qwB2M8rrkpRqbjvvq3qYazF1cTqFArm3RkTu JbZyM0uneP4mqOdUoNgmR0yfVx9YV+1jH8yb1R7x1PPT6AGK6GQW6oqnCf/fsj1xQ1W9 zPhvF42Ix891dAAc4Nw7V+No9L71s2TBDuugQH3dlDHM5X6PNPbIX0IaPGCjyqdKKiTc LhZA== X-Gm-Message-State: AOAM5324ftMO25x5jU/SCkTWux5tI+9545MIhd+ENI16EnIpPVbt1Kz9 +sCeJTOOPn+qGQPjVCejRmgNz6L5Og== X-Google-Smtp-Source: ABdhPJzEEd/8epb1+654jMmftgxgjAAecU9Qg7OIOIb97zqAagBZmdlsIaDzWjyhw8G/Sf1veJwYqg== X-Received: by 2002:a17:902:9349:: with SMTP id g9mr9032052plp.313.1596739781540; Thu, 06 Aug 2020 11:49:41 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:41 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 04/12] mm,hwpoison: Un-export get_hwpoison_page and make it static Date: Thu, 6 Aug 2020 18:49:15 +0000 Message-Id: <20200806184923.7007-5-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 135376C2F X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: From: Oscar Salvador Since get_hwpoison_page is only used in memory-failure code now, let us un-export it and make it private to that code. Signed-off-by: Oscar Salvador Signed-off-by: Naoya Horiguchi --- include/linux/mm.h | 1 - mm/memory-failure.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/mm.h v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/mm.h index 5e76bb4291e6..8f742373a46a 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/mm.h +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/mm.h @@ -2985,7 +2985,6 @@ extern int memory_failure(unsigned long pfn, int flags); extern void memory_failure_queue(unsigned long pfn, int flags); extern void memory_failure_queue_kick(int cpu); extern int unpoison_memory(unsigned long pfn); -extern int get_hwpoison_page(struct page *page); #define put_hwpoison_page(page) put_page(page) extern int sysctl_memory_failure_early_kill; extern int sysctl_memory_failure_recovery; diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index f8d200417e0f..405c9bef6ffb 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -925,7 +925,7 @@ static int page_action(struct page_state *ps, struct page *p, * Return: return 0 if failed to grab the refcount, otherwise true (some * non-zero value.) */ -int get_hwpoison_page(struct page *page) +static int get_hwpoison_page(struct page *page) { struct page *head = compound_head(page); @@ -954,7 +954,6 @@ int get_hwpoison_page(struct page *page) return 0; } -EXPORT_SYMBOL_GPL(get_hwpoison_page); /* * Do all that is necessary to remove user space mappings. Unmap From patchwork Thu Aug 6 18:49:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704093 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 2468F913 for ; Thu, 6 Aug 2020 18:49:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4E8042224D for ; Thu, 6 Aug 2020 18:49:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dz/FUHcx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E8042224D 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 BB2706B000A; Thu, 6 Aug 2020 14:49:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B8B106B000C; Thu, 6 Aug 2020 14:49:46 -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 AA10C6B000D; Thu, 6 Aug 2020 14:49:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id 994856B000A for ; Thu, 6 Aug 2020 14:49:46 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 59826181AEF10 for ; Thu, 6 Aug 2020 18:49:46 +0000 (UTC) X-FDA: 77121032772.11.vase93_550715326fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 400EB180F8B80 for ; Thu, 6 Aug 2020 18:49:46 +0000 (UTC) X-Spam-Summary: 1,0,0,b491282316ff1cfe,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:2:41:69:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1606:1730:1747:1777:1792:2196:2199:2393:2559:2562:2899:2901:3138:3139:3140:3141:3142:3355:3867:3868:3871:3872:4119:4250:4321:4385:5007:6119:6261:6653:6742:7576:7903:8957:9413:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12683:12740:12895:14110:14394:21060:21080:21324:21444:21451:21627:21666:21990:22119:30054,0,RBL:209.85.214.196:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04y8sarq49zus97rnqu7981h7ujenyczs6ucjrtnq3g8or79pijho3f95tqx8db.e3pz1ttkm3dg9koece5f98cioep88bi4jnycksxymxy7e5g4m66gmurm6z56h4u.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:1:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: vase93_550715326fb9 X-Filterd-Recvd-Size: 8564 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:45 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id r4so17607212pls.2 for ; Thu, 06 Aug 2020 11:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OHzHoMnONnHgmQ6oS0LXj3evSeIK3rt+KuGRMSo863I=; b=Dz/FUHcxtrctN3xMt1DQbUbgKE4BGFQVgAWnYnGKbWc1rG7cUkOlMrFX4QU+eoDPKQ GnGj+LQxv7WCng3OYJB8cWxCTMj7ItCLesb2MisVfQEy+jReqxfHqEijUtmihMdBq0qk aGBJtfOlgdfjJC4t23GAMp/aJyJd10t4woaNnbELvcIVK8PClnf83X890FcMZxhMXA9f eN8vrHQSzzNq2CS/vpIADpmWI+D6wp/DBQLovShGMWWKzbsQyNe0f+H1mobidLzLkE4w f5GJPNnTDn72dC4Et9bezwR37xCAheUg2hq0IoOQfl6/qWxlRNrUFXxBizJ1Uy+qUL/s 2QIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OHzHoMnONnHgmQ6oS0LXj3evSeIK3rt+KuGRMSo863I=; b=P9zvIafG/xYFeRiXQPO3/tnDZfB7dMbhjUqexoedy7FC5VKIl93kEd5XrskiDMQX+w ux1AP003otZ041iTuzKybHWX4Gfm+1alEcpk16CT84mr6yFFD6iKTqUxyKqwQhAzFOts YNgz0PZ7H9sPcuQweIPNNZMrEehgzIdd1r48F/uHCVantCv6WLwniqFAx1jMnW87CGDG MWjRYEC/UjR5Wj8MOSiJlyMCbAXzCq+CGYD7hwrAKA3+HM2195cc8ukK0FjlbsY4eZNL 89JKaDwm5xPSttjICmIqrYTCRRN11/epSatkck5JzyawObrnV7jUqr6kSL8DK7CPSVek i08w== X-Gm-Message-State: AOAM531eoXPKnm3e505ADKmCVqFu7MgtTWOv/YXq1hYXy5FOecFDdbeQ 38IA0lwB7m7ondye7DHOEEhdvAz+Pw== X-Google-Smtp-Source: ABdhPJwOKt/AHN3ezXUdFR/uC/px9PuXVtV4Ej0TEsfbGCMh9Y73f9kqSXqZZ8bwVq6A3sRR67fygQ== X-Received: by 2002:a17:902:6b8b:: with SMTP id p11mr8987951plk.23.1596739784694; Thu, 06 Aug 2020 11:49:44 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:44 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 05/12] mm,hwpoison: Kill put_hwpoison_page Date: Thu, 6 Aug 2020 18:49:16 +0000 Message-Id: <20200806184923.7007-6-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 400EB180F8B80 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: From: Oscar Salvador After commit 4e41a30c6d50 ("mm: hwpoison: adjust for new thp refcounting"), put_hwpoison_page got reduced to a put_page. Let us just use put_page instead. Signed-off-by: Oscar Salvador Signed-off-by: Naoya Horiguchi --- include/linux/mm.h | 1 - mm/memory-failure.c | 30 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/mm.h v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/mm.h index 8f742373a46a..371970dfffc4 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/mm.h +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/mm.h @@ -2985,7 +2985,6 @@ extern int memory_failure(unsigned long pfn, int flags); extern void memory_failure_queue(unsigned long pfn, int flags); extern void memory_failure_queue_kick(int cpu); extern int unpoison_memory(unsigned long pfn); -#define put_hwpoison_page(page) put_page(page) extern int sysctl_memory_failure_early_kill; extern int sysctl_memory_failure_recovery; extern void shake_page(struct page *p, int access); diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 405c9bef6ffb..6853bf3a253d 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -1144,7 +1144,7 @@ static int memory_failure_hugetlb(unsigned long pfn, int flags) pr_err("Memory failure: %#lx: just unpoisoned\n", pfn); num_poisoned_pages_dec(); unlock_page(head); - put_hwpoison_page(head); + put_page(head); return 0; } @@ -1336,7 +1336,7 @@ int memory_failure(unsigned long pfn, int flags) pfn); if (TestClearPageHWPoison(p)) num_poisoned_pages_dec(); - put_hwpoison_page(p); + put_page(p); return -EBUSY; } unlock_page(p); @@ -1389,14 +1389,14 @@ int memory_failure(unsigned long pfn, int flags) pr_err("Memory failure: %#lx: just unpoisoned\n", pfn); num_poisoned_pages_dec(); unlock_page(p); - put_hwpoison_page(p); + put_page(p); return 0; } if (hwpoison_filter(p)) { if (TestClearPageHWPoison(p)) num_poisoned_pages_dec(); unlock_page(p); - put_hwpoison_page(p); + put_page(p); return 0; } @@ -1630,9 +1630,9 @@ int unpoison_memory(unsigned long pfn) } unlock_page(page); - put_hwpoison_page(page); + put_page(page); if (freeit && !(pfn == my_zero_pfn(0) && page_count(p) == 1)) - put_hwpoison_page(page); + put_page(page); return 0; } @@ -1683,7 +1683,7 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) /* * Try to free it. */ - put_hwpoison_page(page); + put_page(page); shake_page(page, 1); /* @@ -1692,7 +1692,7 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) ret = __get_any_page(page, pfn, 0); if (ret == 1 && !PageLRU(page)) { /* Drop page reference which is from __get_any_page() */ - put_hwpoison_page(page); + put_page(page); pr_info("soft_offline: %#lx: unknown non LRU page type %lx (%pGp)\n", pfn, page->flags, &page->flags); return -EIO; @@ -1715,7 +1715,7 @@ static int soft_offline_huge_page(struct page *page, int flags) lock_page(hpage); if (PageHWPoison(hpage)) { unlock_page(hpage); - put_hwpoison_page(hpage); + put_page(hpage); pr_info("soft offline: %#lx hugepage already poisoned\n", pfn); return -EBUSY; } @@ -1726,7 +1726,7 @@ static int soft_offline_huge_page(struct page *page, int flags) * get_any_page() and isolate_huge_page() takes a refcount each, * so need to drop one here. */ - put_hwpoison_page(hpage); + put_page(hpage); if (!ret) { pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn); return -EBUSY; @@ -1779,7 +1779,7 @@ static int __soft_offline_page(struct page *page, int flags) wait_on_page_writeback(page); if (PageHWPoison(page)) { unlock_page(page); - put_hwpoison_page(page); + put_page(page); pr_info("soft offline: %#lx page already poisoned\n", pfn); return -EBUSY; } @@ -1794,7 +1794,7 @@ static int __soft_offline_page(struct page *page, int flags) * would need to fix isolation locking first. */ if (ret == 1) { - put_hwpoison_page(page); + put_page(page); pr_info("soft_offline: %#lx: invalidated\n", pfn); SetPageHWPoison(page); num_poisoned_pages_inc(); @@ -1814,7 +1814,7 @@ static int __soft_offline_page(struct page *page, int flags) * Drop page reference which is came from get_any_page() * successful isolate_lru_page() already took another one. */ - put_hwpoison_page(page); + put_page(page); if (!ret) { LIST_HEAD(pagelist); /* @@ -1858,7 +1858,7 @@ static int soft_offline_in_use_page(struct page *page, int flags) pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(page)); else pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(page)); - put_hwpoison_page(page); + put_page(page); return -EBUSY; } unlock_page(page); @@ -1931,7 +1931,7 @@ int soft_offline_page(unsigned long pfn, int flags) if (PageHWPoison(page)) { pr_info("soft offline: %#lx page already poisoned\n", pfn); if (flags & MF_COUNT_INCREASED) - put_hwpoison_page(page); + put_page(page); return -EBUSY; } From patchwork Thu Aug 6 18:49:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704095 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 6FC4B1510 for ; Thu, 6 Aug 2020 18:49:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9A3B922CB3 for ; Thu, 6 Aug 2020 18:49:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Pg0nVi4q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A3B922CB3 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 39CD86B000C; Thu, 6 Aug 2020 14:49:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 374A76B000D; Thu, 6 Aug 2020 14:49:50 -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 2641D6B000E; Thu, 6 Aug 2020 14:49:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id 0F75C6B000C for ; Thu, 6 Aug 2020 14:49:50 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C8440181AEF10 for ; Thu, 6 Aug 2020 18:49:49 +0000 (UTC) X-FDA: 77121032898.16.duck16_3a01c8726fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 9E73C100E690B for ; Thu, 6 Aug 2020 18:49:49 +0000 (UTC) X-Spam-Summary: 1,0,0,0ad45adc87398c3c,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:69:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1535:1542:1711:1730:1747:1777:1792:2393:2559:2562:2693:2899:3138:3139:3140:3141:3142:3353:3865:3866:3868:3870:3872:3874:4321:5007:6119:6120:6261:6653:6742:7576:7901:7903:8957:9413:10004:11026:11473:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12679:12683:12740:12895:14110:14181:14394:14721:21060:21080:21444:21627:21666:21990:22119:30012:30054,0,RBL:209.85.216.67:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04yfdjoj8mh571o8rxquuo1jhizghopjp7aaed7gnpnp3ghmwbn4a1ze9gbge51.164c5bwowsdcyqitcx3d58k9i8qs4nwzibzpzeg353p1z4ghk9buprxcc57kdyd.o-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: duck16_3a01c8726fb9 X-Filterd-Recvd-Size: 5832 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:49 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id mt12so7322398pjb.4 for ; Thu, 06 Aug 2020 11:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=waWNBxGk6iMPpav8Mj47fC2tLAwOLjpd+rtwaTivLoM=; b=Pg0nVi4qfc3JE7BvbZZqMTxAl/O4+2QJe9KQgrXh8iuL9xnFQzxEtbNK9spmDqEEzq lphsXWqzRETj5yg7O6xd7xWKVAnr57l9YK62W14XO8MvAKBiQHluh+D1m4iTCsIxHXsu iLNyVxm4UasjFzZ73MhjOjSajlgz5OI26CobetVi1z0w9tRPRTJeIDBRQmodpQRe3jGx nJp0DvCjcvVlzImdFoY/R7iZYgOrXhv1JXDyuyOqRt8AcytxYY9BwkDr9i4/FVrSfLVS 2Har4jeTBZXvQwrwT3CnoazHJhRVxwPFS4ociGyiHi3Ai9djwPftESUTTPw/6FW6p5OP Xanw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=waWNBxGk6iMPpav8Mj47fC2tLAwOLjpd+rtwaTivLoM=; b=THil9L1S+figPR7+fYKu97wX8/p32zCqC1m3XCxyZz+zvQFy0Ws/xuIGh0X3P1qLaF ybMpjbPtr34Em8QDu4WTisn4UFns5uwBRis/Qr6ZyudYJ8pmuQBwZL8iuHRFS3EoJGGG rPNP8h/UfsXhGxkZv0N1LDzU4XZ4EMfoQ/BwgOdsGE9yhNoLbLH2Ii9EYzPfXyQGppOg KUxM2LhaVi0U0mP/xrY/oqMu/dGD2og7ygq311g2XE7Six0NpuH5dBe4C97lNsL+vD9A XFJSzD2jibRqrvgl+jgV8+Go+UtWCIVoo3GPVe6t3E0wCYDpAjtw8lbfpo1ILY95MDzR HWmQ== X-Gm-Message-State: AOAM530cFDKfKPUfup2K84vN1W84GwhleVoVx2L8Ejr5d3FEhG0iY/V+ knUNrynLivOz6f8JEgrj7L8I0OPAmQ== X-Google-Smtp-Source: ABdhPJy23FvrXJY1ir5JHfjRf2aw0PiitzQkRSXbVYYiLuoHqYf7AnXsXuad9Ycm/ZBgfq6fDoibTQ== X-Received: by 2002:a17:90b:1c06:: with SMTP id oc6mr9305658pjb.182.1596739787945; Thu, 06 Aug 2020 11:49:47 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:47 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 06/12] mm,hwpoison: Unify THP handling for hard and soft offline Date: Thu, 6 Aug 2020 18:49:17 +0000 Message-Id: <20200806184923.7007-7-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 9E73C100E690B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: From: Oscar Salvador 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 Signed-off-by: Naoya Horiguchi --- mm/memory-failure.c | 48 +++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 26 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 6853bf3a253d..276c1588f82a 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -1103,6 +1103,25 @@ static int identify_page_state(unsigned long pfn, struct page *p, return page_action(ps, p, pfn); } +static int try_to_split_thp_page(struct page *page, const char *msg) +{ + lock_page(page); + if (!PageAnon(page) || unlikely(split_huge_page(page))) { + unsigned long pfn = page_to_pfn(page); + + unlock_page(page); + if (!PageAnon(page)) + pr_info("%s: %#lx: non anonymous thp\n", msg, pfn); + else + pr_info("%s: %#lx: thp split failed\n", msg, pfn); + put_page(page); + return -EBUSY; + } + unlock_page(page); + + return 0; +} + static int memory_failure_hugetlb(unsigned long pfn, int flags) { struct page *p = pfn_to_page(pfn); @@ -1325,21 +1344,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; - } - unlock_page(p); VM_BUG_ON_PAGE(!page_count(p), p); } @@ -1850,19 +1856,9 @@ static int soft_offline_in_use_page(struct page *page, int flags) int mt; struct page *hpage = compound_head(page); - if (!PageHuge(page) && PageTransHuge(hpage)) { - lock_page(page); - if (!PageAnon(page) || unlikely(split_huge_page(page))) { - unlock_page(page); - if (!PageAnon(page)) - pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(page)); - else - pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(page)); - put_page(page); + if (!PageHuge(page) && PageTransHuge(hpage)) + if (try_to_split_thp_page(page, "soft offline") < 0) return -EBUSY; - } - unlock_page(page); - } /* * Setting MIGRATE_ISOLATE here ensures that the page will be linked From patchwork Thu Aug 6 18:49:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704097 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 96BCA1510 for ; Thu, 6 Aug 2020 18:49:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BC0E82224D for ; Thu, 6 Aug 2020 18:49:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JasDQCuz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC0E82224D 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 525BF6B000D; Thu, 6 Aug 2020 14:49:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 486B96B000E; Thu, 6 Aug 2020 14:49:53 -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 34E676B0010; Thu, 6 Aug 2020 14:49:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0214.hostedemail.com [216.40.44.214]) by kanga.kvack.org (Postfix) with ESMTP id 1C0236B000D for ; Thu, 6 Aug 2020 14:49:53 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D7EE7824934B for ; Thu, 6 Aug 2020 18:49:52 +0000 (UTC) X-FDA: 77121033024.21.story00_59146ba26fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id A5677180442C0 for ; Thu, 6 Aug 2020 18:49:52 +0000 (UTC) X-Spam-Summary: 1,0,0,46877806211d43d6,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:2:41:355:379:541:800:960:965:966:973:988:989:1260:1345:1359:1437:1535:1606:1730:1747:1777:1792:2194:2196:2198:2199:2200:2201:2393:2559:2562:2693:2731:2898:2899:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3872:3874:4119:4321:4385:4390:4395:4421:4605:5007:6119:6261:6653:6742:7576:7875:7903:8603:8660:8957:9036:9413:9707:10004:11026:11232:11473:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12679:12683:12740:12895:12986:13148:13161:13229:13230:14096:14394:21060:21080:21094:21323:21444:21451:21627:21666:21939:21990:22119:30054:30070,0,RBL:209.85.210.196:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yf9xf3d6czcs33qhbc3yfa8n3htop1q3pryprcpkwep6hb8yd17193paz49d5.kiur1kgpxse1z86w1f4y48whn8urp4mb7cxufrtop4wmwd8jggs4wr98qwnh9bt.s-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNS BL:none, X-HE-Tag: story00_59146ba26fb9 X-Filterd-Recvd-Size: 8392 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:52 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id y206so15303522pfb.10 for ; Thu, 06 Aug 2020 11:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gsGWqW4ZaiFQhMVFrKJuaHZLM1FtGshPHyEY7H8wkmw=; b=JasDQCuzAi9JU34kUOcms8Rny8c5MOxnv8J5r/VdpwC8f1DZMyerK9OxUP3OxbhyF4 4Xaqnj6vkNHY2rR/0/sZpx7QtyK7+SfqCcbKDowrZavKpRD0mxp8K0YqYG6MLv2KtvWp ku0CmQ5+s5hHzzFlADCqvSe7l03TKxFrZBNQPaVydA1O7A3OWH5WLtVnhqdLIM6kht+0 veP1qChzI0rGksZXi8gnw+7JV1EuwSZuTI5IzwqGhz8UyhN9cribOrezzzpZA8szw/x5 YWf161hzfuMOpYLq0Qzreg9KIgHmlaebdUh+Uh+7UE8uVFnEf8d/h0o/gEIptVmh8qIp yhcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gsGWqW4ZaiFQhMVFrKJuaHZLM1FtGshPHyEY7H8wkmw=; b=FhuId31USmmD132k2NEHqcj2UHoe3elWa3US6fKZz8Fdh2MUHX0/nNfwolbcG4yeoq I38HeZODm+l/RjTU2PkC1qeJ7YlM/YDq79xN6Kr9/LDmJP3s1cjwDm4BMjNtvclWtDV8 zy5jqvABEU9k3vFB2a/HEfpbgFsdjFltx64Si7pAvcUInCCetXsUKhl2cgV4R6/KmHT7 T4WUeP6iyLjqjGa97bkcZrmB1bUgNT47shb+mhZANSGyBaHIMnKh8X4UT9r6Cy5Mgs4A GdAwJE1TTkQ8xqZnhYHyWQqjZ7lrNkTMrBy48+F7u4KkKVEKINyfJDQZszvUE6EtRkaI y3KA== X-Gm-Message-State: AOAM5322/aejzJKHngRPBRtHPLwSVUCYOyXY1jxluxLBEIiE/ImZlSmH ytxsh7VUSlFdbT+IQR6Gcg1RDd11dQ== X-Google-Smtp-Source: ABdhPJx7ZnxiVWey9oH5CdH2kdR14A4rtMbx2qpf9s3VDDyV31G6qsQ00AoP5BHlqeGfpyNKncwFLg== X-Received: by 2002:aa7:8182:: with SMTP id g2mr9240754pfi.261.1596739791120; Thu, 06 Aug 2020 11:49:51 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:50 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 07/12] mm,hwpoison: Rework soft offline for free pages Date: Thu, 6 Aug 2020 18:49:18 +0000 Message-Id: <20200806184923.7007-8-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: A5677180442C0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: From: Oscar Salvador When trying to soft-offline a free page, we need to first take it off the buddy allocator. Once we know is out of reach, we can safely flag it as poisoned. take_page_off_buddy will be used to take a page meant to be poisoned off the buddy allocator. take_page_off_buddy calls break_down_buddy_pages, which splits a higher-order page in case our page belongs to one. Once the page is under our control, we call page_handle_poison to set it as poisoned and grab a refcount on it. Signed-off-by: Oscar Salvador Signed-off-by: Naoya Horiguchi --- ChangeLog v4 -> v5: - fix comile error ChangeLog v2 -> v3: - use add_to_free_list() instead of add_to_free_area() - use del_page_from_free_list() instead of del_page_from_free_area() - add fast return - move extern definition to header file as warned by checkpatch.pl --- include/linux/page-flags.h | 1 + mm/memory-failure.c | 18 ++++++---- mm/page_alloc.c | 68 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 6 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/page-flags.h v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/page-flags.h index 6be1aa559b1e..9fa5d4e2d69a 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/page-flags.h +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/page-flags.h @@ -423,6 +423,7 @@ PAGEFLAG(HWPoison, hwpoison, PF_ANY) TESTSCFLAG(HWPoison, hwpoison, PF_ANY) #define __PG_HWPOISON (1UL << PG_hwpoison) extern bool set_hwpoison_free_buddy_page(struct page *page); +extern bool take_page_off_buddy(struct page *page); #else PAGEFLAG_FALSE(HWPoison) static inline bool set_hwpoison_free_buddy_page(struct page *page) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 276c1588f82a..0e619012e050 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -65,6 +65,13 @@ int sysctl_memory_failure_recovery __read_mostly = 1; atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0); +static void page_handle_poison(struct page *page) +{ + SetPageHWPoison(page); + page_ref_inc(page); + num_poisoned_pages_inc(); +} + #if defined(CONFIG_HWPOISON_INJECT) || defined(CONFIG_HWPOISON_INJECT_MODULE) u32 hwpoison_filter_enable = 0; @@ -1879,14 +1886,13 @@ static int soft_offline_in_use_page(struct page *page, int flags) static int soft_offline_free_page(struct page *page) { - int rc = dissolve_free_huge_page(page); + int rc = -EBUSY; - if (!rc) { - if (set_hwpoison_free_buddy_page(page)) - num_poisoned_pages_inc(); - else - rc = -EBUSY; + if (!dissolve_free_huge_page(page) && take_page_off_buddy(page)) { + page_handle_poison(page); + rc = 0; } + return rc; } diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/page_alloc.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/page_alloc.c index efe2e94c45f5..aab89f7db4ac 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/page_alloc.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/page_alloc.c @@ -8776,6 +8776,74 @@ bool is_free_buddy_page(struct page *page) } #ifdef CONFIG_MEMORY_FAILURE +/* + * Break down a higher-order page in sub-pages, and keep our target out of + * buddy allocator. + */ +static void break_down_buddy_pages(struct zone *zone, struct page *page, + struct page *target, int low, int high, + int migratetype) +{ + unsigned long size = 1 << high; + struct page *current_buddy, *next_page; + + while (high > low) { + high--; + size >>= 1; + + if (target >= &page[size]) { + next_page = page + size; + current_buddy = page; + } else { + next_page = page; + current_buddy = page + size; + } + + if (set_page_guard(zone, current_buddy, high, migratetype)) + continue; + + if (current_buddy != target) { + add_to_free_list(current_buddy, zone, high, migratetype); + set_page_order(current_buddy, high); + page = next_page; + } + } +} + +/* + * Take a page that will be marked as poisoned off the buddy allocator. + */ +bool take_page_off_buddy(struct page *page) +{ + struct zone *zone = page_zone(page); + unsigned long pfn = page_to_pfn(page); + unsigned long flags; + unsigned int order; + bool ret = false; + + spin_lock_irqsave(&zone->lock, flags); + for (order = 0; order < MAX_ORDER; order++) { + struct page *page_head = page - (pfn & ((1 << order) - 1)); + int buddy_order = page_order(page_head); + + if (PageBuddy(page_head) && buddy_order >= order) { + unsigned long pfn_head = page_to_pfn(page_head); + int migratetype = get_pfnblock_migratetype(page_head, + pfn_head); + + del_page_from_free_list(page_head, zone, buddy_order); + break_down_buddy_pages(zone, page_head, page, 0, + buddy_order, migratetype); + ret = true; + break; + } + if (page_count(page_head) > 0) + break; + } + spin_unlock_irqrestore(&zone->lock, flags); + return ret; +} + /* * Set PG_hwpoison flag if a given page is confirmed to be a free page. This * test is performed under the zone lock to prevent a race against page From patchwork Thu Aug 6 18:49:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704099 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 E10CC913 for ; Thu, 6 Aug 2020 18:49:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1304F2224D for ; Thu, 6 Aug 2020 18:49:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dag3wQDF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1304F2224D 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 A7AFF6B000E; Thu, 6 Aug 2020 14:49:56 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9DFA46B0010; Thu, 6 Aug 2020 14:49:56 -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 87E6D8D0001; Thu, 6 Aug 2020 14:49:56 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 6A4286B000E for ; Thu, 6 Aug 2020 14:49:56 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2ED5C824934B for ; Thu, 6 Aug 2020 18:49:56 +0000 (UTC) X-FDA: 77121033192.21.kitty14_551709026fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 03F16180442C2 for ; Thu, 6 Aug 2020 18:49:55 +0000 (UTC) X-Spam-Summary: 1,0,0,017588505e84c85e,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:1:2:41:69:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1605:1730:1747:1777:1792:2194:2196:2198:2199:2200:2201:2393:2559:2562:2693:2731:2899:3138:3139:3140:3141:3142:3865:3866:3867:3868:3870:3871:3872:3874:4052:4250:4321:4385:4605:5007:6119:6261:6653:6742:7576:7875:7903:8660:8957:9010:9413:9592:9707:10004:11026:11232:11473:11658:11914:12043:12257:12296:12297:12438:12517:12519:12555:12679:12683:12740:12895:12986:13148:13230:14096:14394:21060:21080:21094:21220:21323:21324:21444:21451:21627:21666:21740:21795:21939:21987:21990:22119:30012:30051:30054:30070:30083:30091,0,RBL:209.85.214.193:@gmail.com:.lbl8.mailshell.net-66.100.201.100 62.50.0.100;04yfg7nqjju9ju9isyai8oocwd5stopqakqwcukeusoz53iiukz7n14jgi765sh.5664hymf4o3jezx39tx5eka4aw3bx58ogt99s9y74ty4udxqwiycj4zaz7u5ehs.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk ,SPF:fp, X-HE-Tag: kitty14_551709026fb9 X-Filterd-Recvd-Size: 12727 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:55 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id q17so28225269pls.9 for ; Thu, 06 Aug 2020 11:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iOnU5DPTFBCJZrA4qYHBhE1N2Tyk26DBmuGxhFL9n1g=; b=Dag3wQDFd+V8irlHhdwBYMJYcyJMuI37lHSRSLvaxjHpwKtmho7dSkKdTg749ieFjj 4fWWddqSv+QxU4JnoI+c7m847PsEn1+CdNnqnPk2py55YDzW/R3KXsmQ+/LTy/wbJhWb COeVSbisnMV1uywrKpNn4Rz6Rer/DZNHnHCnHKPahAhp2ul5k3oMxkde8ZE0oRe/aeJx YbPt9zBv/mmztlIP+WJ5NliJiGJzeVjCMAdM08crWVLJEiOBh4nsaZqf4ZQpgGJlm9qo 5JB2yDRY5M+4QHjalTdEHFElzXw8e9qRA7msU3Y50rwvLguG1wYIATPyr7NWi5EaRod0 0zgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iOnU5DPTFBCJZrA4qYHBhE1N2Tyk26DBmuGxhFL9n1g=; b=WyJH3FJ0LcLkmDMbxOoaJVi2r6qRZ/MZUi4Q8y2jC3hIrHFVmAsY7CyjQ0WGwicUvH HCjl8tNj93uscvNFK2g+e6l4PBicIgg6ZEOd6zFPfzyXHE2TbPG1sHy3c4ZB7NTG+Hxh 5dEsNqJTtWaIgeW0HyUJfkwtXE5uhZHP0b8ee0lGPzxTP8xx05oLT7jXZIXYkXlq6817 LuBPRKEID7sknbrgmLms2dpOzdu5qq0tAiYAG2Lp6HrDOUPiQgB4UtqadDozeRXK2Vts LDLlseRlCyczjW0WCze0tgcJQ7VsRIuuhEAp5/jEIK+bU2njqYzfSBMpBCqdUuv2A06r +NbQ== X-Gm-Message-State: AOAM532sQnGdyWnGbYz/K/iwg6WvAieycXJ4SRL0FLBuSaGK338kzzJ0 wlnoAFe5uh3KeoNRRQ1YUhCrJBOfvQ== X-Google-Smtp-Source: ABdhPJw4YUpZ0RT9qBcliQ2izOnsbFPf8GMpwdFvZDBi6HblTGsyJ/O/36XXVEg1clIuKrmT01apzQ== X-Received: by 2002:a17:90a:b24:: with SMTP id 33mr1965843pjq.123.1596739794337; Thu, 06 Aug 2020 11:49:54 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:53 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 08/12] mm,hwpoison: Rework soft offline for in-use pages Date: Thu, 6 Aug 2020 18:49:19 +0000 Message-Id: <20200806184923.7007-9-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 03F16180442C2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: From: Oscar Salvador This patch changes the way we set and handle in-use poisoned pages. Until now, poisoned pages were released to the buddy allocator, trusting that the checks that take place prior to hand the page would act as a safe net and would skip that page. This has proved to be wrong, as we got some pfn walkers out there, like compaction, that all they care is the page to be PageBuddy and be in a freelist. Although this might not be the only user, having poisoned pages in the buddy allocator seems a bad idea as we should only have free pages that are ready and meant to be used as such. Before explaining the taken approach, let us break down the kind of pages we can soft offline. - Anonymous THP (after the split, they end up being 4K pages) - Hugetlb - Order-0 pages (that can be either migrated or invalited) * Normal pages (order-0 and anon-THP) - If they are clean and unmapped page cache pages, we invalidate then by means of invalidate_inode_page(). - If they are mapped/dirty, we do the isolate-and-migrate dance. Either way, do not call put_page directly from those paths. Instead, we keep the page and send it to page_set_poison to perform the right handling. page_set_poison sets the HWPoison flag and does the last put_page. This call to put_page is mainly to be able to call __page_cache_release, since this function is not exported. Down the chain, we placed a check for HWPoison page in free_pages_prepare, that just skips any poisoned page, so those pages do not end up in any pcplist/freelist. After that, we set the refcount on the page to 1 and we increment the poisoned pages counter. We could do as we do for free pages: 1) wait until the page hits buddy's freelists 2) take it off 3) flag it The problem is that we could race with an allocation, so by the time we want to take the page off the buddy, the page is already allocated, so we cannot soft-offline it. This is not fatal of course, but if it is better if we can close the race as does not require a lot of code. * Hugetlb pages - We isolate-and-migrate them After the migration has been successful, we call dissolve_free_huge_page, and we set HWPoison on the page if we succeed. Hugetlb has a slightly different handling though. While for non-hugetlb pages we cared about closing the race with an allocation, doing so for hugetlb pages requires quite some additional code (we would need to hook in free_huge_page and some other places). So I decided to not make the code overly complicated and just fail normally if the page we allocated in the meantime. Because of the way we handle now in-use pages, we no longer need the put-as-isolation-migratetype dance, that was guarding for poisoned pages to end up in pcplists. Signed-off-by: Oscar Salvador Signed-off-by: Naoya Horiguchi --- include/linux/page-flags.h | 5 ----- mm/memory-failure.c | 45 ++++++++++++++------------------------ mm/migrate.c | 11 +++------- mm/page_alloc.c | 28 ------------------------ 4 files changed, 19 insertions(+), 70 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/page-flags.h v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/page-flags.h index 9fa5d4e2d69a..d1df51ed6eeb 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/page-flags.h +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/page-flags.h @@ -422,14 +422,9 @@ PAGEFLAG_FALSE(Uncached) PAGEFLAG(HWPoison, hwpoison, PF_ANY) TESTSCFLAG(HWPoison, hwpoison, PF_ANY) #define __PG_HWPOISON (1UL << PG_hwpoison) -extern bool set_hwpoison_free_buddy_page(struct page *page); extern bool take_page_off_buddy(struct page *page); #else PAGEFLAG_FALSE(HWPoison) -static inline bool set_hwpoison_free_buddy_page(struct page *page) -{ - return 0; -} #define __PG_HWPOISON 0 #endif diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 0e619012e050..95bf8aa44a9a 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -65,8 +65,12 @@ int sysctl_memory_failure_recovery __read_mostly = 1; atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0); -static void page_handle_poison(struct page *page) +static void page_handle_poison(struct page *page, bool release) { + if (release) { + put_page(page); + drain_all_pages(page_zone(page)); + } SetPageHWPoison(page); page_ref_inc(page); num_poisoned_pages_inc(); @@ -1756,19 +1760,13 @@ static int soft_offline_huge_page(struct page *page, int flags) ret = -EIO; } else { /* - * We set PG_hwpoison only when the migration source hugepage - * was successfully dissolved, because otherwise hwpoisoned - * hugepage remains on free hugepage list, then userspace will - * find it as SIGBUS by allocation failure. That's not expected - * in soft-offlining. + * We set PG_hwpoison only when we were able to take the page + * off the buddy. */ - ret = dissolve_free_huge_page(page); - if (!ret) { - if (set_hwpoison_free_buddy_page(page)) - num_poisoned_pages_inc(); - else - ret = -EBUSY; - } + if (!dissolve_free_huge_page(page) && take_page_off_buddy(page)) + page_handle_poison(page, false); + else + ret = -EBUSY; } return ret; } @@ -1807,10 +1805,8 @@ static int __soft_offline_page(struct page *page, int flags) * would need to fix isolation locking first. */ if (ret == 1) { - put_page(page); pr_info("soft_offline: %#lx: invalidated\n", pfn); - SetPageHWPoison(page); - num_poisoned_pages_inc(); + page_handle_poison(page, true); return 0; } @@ -1841,7 +1837,9 @@ static int __soft_offline_page(struct page *page, int flags) list_add(&page->lru, &pagelist); ret = migrate_pages(&pagelist, alloc_migration_target, NULL, (unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_FAILURE); - if (ret) { + if (!ret) { + page_handle_poison(page, true); + } else { if (!list_empty(&pagelist)) putback_movable_pages(&pagelist); @@ -1860,27 +1858,16 @@ static int __soft_offline_page(struct page *page, int flags) static int soft_offline_in_use_page(struct page *page, int flags) { int ret; - int mt; struct page *hpage = compound_head(page); if (!PageHuge(page) && PageTransHuge(hpage)) if (try_to_split_thp_page(page, "soft offline") < 0) return -EBUSY; - /* - * Setting MIGRATE_ISOLATE here ensures that the page will be linked - * to free list immediately (not via pcplist) when released after - * successful page migration. Otherwise we can't guarantee that the - * page is really free after put_page() returns, so - * set_hwpoison_free_buddy_page() highly likely fails. - */ - mt = get_pageblock_migratetype(page); - set_pageblock_migratetype(page, MIGRATE_ISOLATE); if (PageHuge(page)) ret = soft_offline_huge_page(page, flags); else ret = __soft_offline_page(page, flags); - set_pageblock_migratetype(page, mt); return ret; } @@ -1889,7 +1876,7 @@ static int soft_offline_free_page(struct page *page) int rc = -EBUSY; if (!dissolve_free_huge_page(page) && take_page_off_buddy(page)) { - page_handle_poison(page); + page_handle_poison(page, false); rc = 0; } diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/migrate.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/migrate.c index 2c809ffcf0e1..d7a9379c343b 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/migrate.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/migrate.c @@ -1222,16 +1222,11 @@ static int unmap_and_move(new_page_t get_new_page, * we want to retry. */ if (rc == MIGRATEPAGE_SUCCESS) { - put_page(page); - if (reason == MR_MEMORY_FAILURE) { + if (reason != MR_MEMORY_FAILURE) /* - * Set PG_HWPoison on just freed page - * intentionally. Although it's rather weird, - * it's how HWPoison flag works at the moment. + * We release the page in page_handle_poison. */ - if (set_hwpoison_free_buddy_page(page)) - num_poisoned_pages_inc(); - } + put_page(page); } else { if (rc != -EAGAIN) { if (likely(!__PageMovable(page))) { diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/page_alloc.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/page_alloc.c index aab89f7db4ac..e4896e674594 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/page_alloc.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/page_alloc.c @@ -8843,32 +8843,4 @@ bool take_page_off_buddy(struct page *page) spin_unlock_irqrestore(&zone->lock, flags); return ret; } - -/* - * Set PG_hwpoison flag if a given page is confirmed to be a free page. This - * test is performed under the zone lock to prevent a race against page - * allocation. - */ -bool set_hwpoison_free_buddy_page(struct page *page) -{ - struct zone *zone = page_zone(page); - unsigned long pfn = page_to_pfn(page); - unsigned long flags; - unsigned int order; - bool hwpoisoned = false; - - spin_lock_irqsave(&zone->lock, flags); - for (order = 0; order < MAX_ORDER; order++) { - struct page *page_head = page - (pfn & ((1 << order) - 1)); - - if (PageBuddy(page_head) && page_order(page_head) >= order) { - if (!TestSetPageHWPoison(page)) - hwpoisoned = true; - break; - } - } - spin_unlock_irqrestore(&zone->lock, flags); - - return hwpoisoned; -} #endif From patchwork Thu Aug 6 18:49:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704101 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 68432138C for ; Thu, 6 Aug 2020 18:50:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8C18C2224D for ; Thu, 6 Aug 2020 18:50:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lP5znRnS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C18C2224D 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 106406B0010; Thu, 6 Aug 2020 14:50:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0B5D58D0001; Thu, 6 Aug 2020 14:50:00 -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 E4AA36B0023; Thu, 6 Aug 2020 14:49:59 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id CB7EF6B0010 for ; Thu, 6 Aug 2020 14:49:59 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8B695824934B for ; Thu, 6 Aug 2020 18:49:59 +0000 (UTC) X-FDA: 77121033318.16.doll07_0c07e8b26fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 5D538100E6903 for ; Thu, 6 Aug 2020 18:49:59 +0000 (UTC) X-Spam-Summary: 1,0,0,346e7c41e1c43041,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:1:2:41:69:355:379:541:800:960:966:973:982:988:989:1260:1345:1359:1437:1605:1730:1747:1777:1792:2194:2196:2198:2199:2200:2201:2393:2559:2562:2693:2731:2899:3138:3139:3140:3141:3142:3865:3866:3867:3868:3870:3871:3872:3874:4052:4250:4321:4385:5007:6119:6261:6653:6742:7576:7875:7903:8957:9010:9413:9592:11026:11232:11473:11658:11914:12043:12114:12291:12296:12297:12438:12517:12519:12555:12679:12683:12740:12895:13180:13229:13255:14096:14394:21060:21080:21094:21220:21323:21324:21444:21451:21627:21666:21740:21939:21987:21990:22119:30012:30034:30054:30070,0,RBL:209.85.210.196:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yg4wxaouhfbo3ite9gtodugpgi1opm6mr76wi7rcm7mkf8euuk5d7gtxsqhqy.uxyn51caxxoyg13mxdqdr3m86meiy6urpcbg78qfnoo9axanfxtbf1rkdgrhg1b.e-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral, Custom_r X-HE-Tag: doll07_0c07e8b26fb9 X-Filterd-Recvd-Size: 12733 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:49:58 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id k18so18364926pfp.7 for ; Thu, 06 Aug 2020 11:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c2Avd1ymuet/tH9gLpxvYhCg3U4qIQ401CWXw7mzKrk=; b=lP5znRnSs48Jr045ixAGYtn2xK/GiZjXZl94MmV7kuyp5exJCHElM0MORvJTQRSuB/ CKqSLJZ49AgIbdLeprP1EtMrMdXwBepaHPSwnBDsIhmwbiKUVTgJGfZrVulrdKM65RVK dB3/q90xqRCkSyclslMfMkE9Su/3Leqx8Oj5dP52p/z1MCgQ6XCfJBKwTiJcVMkbUv0C Ny3yGwfok7w6IPt080R3wRq4OFw3BxI/aH62v2qj2IHVgoA9UrLmiH012hR668iNlPbr uiuwtk/cf6M3JL6Tv8TQxkqDc2fIwbSCuD4npmibQoMpCj2Yll/U4i3UyyANIscqc6Ws bqSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c2Avd1ymuet/tH9gLpxvYhCg3U4qIQ401CWXw7mzKrk=; b=Ok1olAgWsPTFca+xU9P8Z9JkLhhnqILrgCFUgPZrruvQJoFuMh9L0VqUxWdcQ5fKrL xgZH2lAq7cdeb1fu2fP/MUoXqaHApImqKVJttExhFandeZfnwU3otXy9E2sXr1sgCFSQ v2RpZs9rZYlOwYgN/wC1M1wB+XIxklaNJ79G78wxn0TaDPWVUOnbiXbZmXP0VG1MVwqL 7xwbH8rpLI6Jnqu94BKY8hw3F0FqTEx4D9hqHcWQ0HV3HVrRJTa2tc864Ii5xFvcC0td ozDl4cPHQOMxNl4GDpDUl+v9dUC5/FkLwbMQs38RNw0LzSqDaEcADKB5ZJ6q/fMpNDqq WsKQ== X-Gm-Message-State: AOAM5304uuznh6GfvpzZXsmB5h+B9sqaycjO8R8oz3+HOm9OS/UwHqrL uExpH2Uqqm32WF1hmAZvGci1UNUJnA== X-Google-Smtp-Source: ABdhPJxZ3HPx90oxIcIH1ZufFl69P8/nuFLdp3UnE6QWQUH3yfI1SEa7pGjN1nRAh4hl+FVlUzdqCw== X-Received: by 2002:a62:7ac2:: with SMTP id v185mr9681664pfc.277.1596739797598; Thu, 06 Aug 2020 11:49:57 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:49:57 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 09/12] mm,hwpoison: Refactor soft_offline_huge_page and __soft_offline_page Date: Thu, 6 Aug 2020 18:49:20 +0000 Message-Id: <20200806184923.7007-10-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 5D538100E6903 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: From: Oscar Salvador Merging soft_offline_huge_page and __soft_offline_page let us get rid of quite some duplicated code, and makes the code much easier to follow. Now, __soft_offline_page will handle both normal and hugetlb pages. Note that move put_page() block to the beginning of page_handle_poison() with drain_all_pages() in order to make sure that the target page is freed and sent into free list to make take_page_off_buddy() work properly. Signed-off-by: Oscar Salvador Signed-off-by: Naoya Horiguchi --- ChangeLog v4 -> v5: - use "char const *msg_page[]" instead of "const char *msg_page[]" - move adding drain_all_pages() to 12/16 ChangeLog v2 -> v3: - use page_is_file_lru() instead of page_is_file_cache(), - add description about put_page() and drain_all_pages(). - fix coding style warnings by checkpatch.pl --- mm/memory-failure.c | 183 ++++++++++++++++++++------------------------ 1 file changed, 83 insertions(+), 100 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 95bf8aa44a9a..3a2cd094b77f 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -65,15 +65,33 @@ int sysctl_memory_failure_recovery __read_mostly = 1; atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0); -static void page_handle_poison(struct page *page, bool release) +static bool page_handle_poison(struct page *page, bool hugepage_or_freepage, bool release) { if (release) { put_page(page); drain_all_pages(page_zone(page)); } + + if (hugepage_or_freepage) { + /* + * Doing this check for free pages is also fine since dissolve_free_huge_page + * returns 0 for non-hugetlb pages as well. + */ + if (dissolve_free_huge_page(page) || !take_page_off_buddy(page)) + /* + * We could fail to take off the target page from buddy + * for example due to racy page allocaiton, but that's + * acceptable because soft-offlined page is not broken + * and if someone really want to use it, they should + * take it. + */ + return false; + } + SetPageHWPoison(page); page_ref_inc(page); num_poisoned_pages_inc(); + return true; } #if defined(CONFIG_HWPOISON_INJECT) || defined(CONFIG_HWPOISON_INJECT_MODULE) @@ -1718,63 +1736,52 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) return ret; } -static int soft_offline_huge_page(struct page *page, int flags) +static bool isolate_page(struct page *page, struct list_head *pagelist) { - int ret; - unsigned long pfn = page_to_pfn(page); - struct page *hpage = compound_head(page); - LIST_HEAD(pagelist); + bool isolated = false; + bool lru = PageLRU(page); + + if (PageHuge(page)) { + isolated = isolate_huge_page(page, pagelist); + } else { + if (lru) + isolated = !isolate_lru_page(page); + else + isolated = !isolate_movable_page(page, ISOLATE_UNEVICTABLE); + + if (isolated) + list_add(&page->lru, pagelist); - /* - * This double-check of PageHWPoison is to avoid the race with - * memory_failure(). See also comment in __soft_offline_page(). - */ - lock_page(hpage); - if (PageHWPoison(hpage)) { - unlock_page(hpage); - put_page(hpage); - pr_info("soft offline: %#lx hugepage already poisoned\n", pfn); - return -EBUSY; } - unlock_page(hpage); - ret = isolate_huge_page(hpage, &pagelist); + if (isolated && lru) + inc_node_page_state(page, NR_ISOLATED_ANON + + page_is_file_lru(page)); + /* - * get_any_page() and isolate_huge_page() takes a refcount each, - * so need to drop one here. + * If we succeed to isolate the page, we grabbed another refcount on + * the page, so we can safely drop the one we got from get_any_pages(). + * If we failed to isolate the page, it means that we cannot go further + * and we will return an error, so drop the reference we got from + * get_any_pages() as well. */ - put_page(hpage); - if (!ret) { - pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn); - return -EBUSY; - } - - ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, - MIGRATE_SYNC, MR_MEMORY_FAILURE); - if (ret) { - pr_info("soft offline: %#lx: hugepage migration failed %d, type %lx (%pGp)\n", - pfn, ret, page->flags, &page->flags); - if (!list_empty(&pagelist)) - putback_movable_pages(&pagelist); - if (ret > 0) - ret = -EIO; - } else { - /* - * We set PG_hwpoison only when we were able to take the page - * off the buddy. - */ - if (!dissolve_free_huge_page(page) && take_page_off_buddy(page)) - page_handle_poison(page, false); - else - ret = -EBUSY; - } - return ret; + put_page(page); + return isolated; } -static int __soft_offline_page(struct page *page, int flags) +/* + * __soft_offline_page handles hugetlb-pages and non-hugetlb pages. + * If the page is a non-dirty unmapped page-cache page, it simply invalidates. + * If the page is mapped, it migrates the contents over. + */ +static int __soft_offline_page(struct page *page) { - int ret; + int ret = 0; unsigned long pfn = page_to_pfn(page); + struct page *hpage = compound_head(page); + char const *msg_page[] = {"page", "hugepage"}; + bool huge = PageHuge(page); + LIST_HEAD(pagelist); struct migration_target_control mtc = { .nid = NUMA_NO_NODE, .gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL, @@ -1787,98 +1794,74 @@ static int __soft_offline_page(struct page *page, int flags) * so there's no race between soft_offline_page() and memory_failure(). */ lock_page(page); - wait_on_page_writeback(page); + if (!PageHuge(page)) + wait_on_page_writeback(page); if (PageHWPoison(page)) { unlock_page(page); put_page(page); pr_info("soft offline: %#lx page already poisoned\n", pfn); return -EBUSY; } - /* - * Try to invalidate first. This should work for - * non dirty unmapped page cache pages. - */ - ret = invalidate_inode_page(page); + + if (!PageHuge(page)) + /* + * Try to invalidate first. This should work for + * non dirty unmapped page cache pages. + */ + ret = invalidate_inode_page(page); unlock_page(page); + /* * RED-PEN would be better to keep it isolated here, but we * would need to fix isolation locking first. */ - if (ret == 1) { + if (ret) { pr_info("soft_offline: %#lx: invalidated\n", pfn); - page_handle_poison(page, true); + page_handle_poison(page, false, true); return 0; } - /* - * Simple invalidation didn't work. - * Try to migrate to a new page instead. migrate.c - * handles a large number of cases for us. - */ - if (PageLRU(page)) - ret = isolate_lru_page(page); - else - ret = isolate_movable_page(page, ISOLATE_UNEVICTABLE); - /* - * Drop page reference which is came from get_any_page() - * successful isolate_lru_page() already took another one. - */ - put_page(page); - if (!ret) { - LIST_HEAD(pagelist); - /* - * After isolated lru page, the PageLRU will be cleared, - * so use !__PageMovable instead for LRU page's mapping - * cannot have PAGE_MAPPING_MOVABLE. - */ - if (!__PageMovable(page)) - inc_node_page_state(page, NR_ISOLATED_ANON + - page_is_file_lru(page)); - list_add(&page->lru, &pagelist); + if (isolate_page(hpage, &pagelist)) { ret = migrate_pages(&pagelist, alloc_migration_target, NULL, (unsigned long)&mtc, MIGRATE_SYNC, MR_MEMORY_FAILURE); if (!ret) { - page_handle_poison(page, true); + bool release = !huge; + + if (!page_handle_poison(page, true, release)) + ret = -EBUSY; } else { if (!list_empty(&pagelist)) putback_movable_pages(&pagelist); - pr_info("soft offline: %#lx: migration failed %d, type %lx (%pGp)\n", - pfn, ret, page->flags, &page->flags); + + pr_info("soft offline: %#lx: %s migration failed %d, type %lx (%pGp)\n", + pfn, msg_page[huge], ret, page->flags, &page->flags); if (ret > 0) ret = -EIO; } } else { - pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx (%pGp)\n", - pfn, ret, page_count(page), page->flags, &page->flags); + pr_info("soft offline: %#lx: %s isolation failed: %d, page count %d, type %lx (%pGp)\n", + pfn, msg_page[huge], ret, page_count(page), page->flags, &page->flags); } return ret; } -static int soft_offline_in_use_page(struct page *page, int flags) +static int soft_offline_in_use_page(struct page *page) { - int ret; struct page *hpage = compound_head(page); if (!PageHuge(page) && PageTransHuge(hpage)) if (try_to_split_thp_page(page, "soft offline") < 0) return -EBUSY; - - if (PageHuge(page)) - ret = soft_offline_huge_page(page, flags); - else - ret = __soft_offline_page(page, flags); - return ret; + return __soft_offline_page(page); } static int soft_offline_free_page(struct page *page) { - int rc = -EBUSY; + int rc = 0; - if (!dissolve_free_huge_page(page) && take_page_off_buddy(page)) { - page_handle_poison(page, false); - rc = 0; - } + if (!page_handle_poison(page, true, false)) + rc = -EBUSY; return rc; } @@ -1929,7 +1912,7 @@ int soft_offline_page(unsigned long pfn, int flags) put_online_mems(); if (ret > 0) - ret = soft_offline_in_use_page(page, flags); + ret = soft_offline_in_use_page(page); else if (ret == 0) ret = soft_offline_free_page(page); From patchwork Thu Aug 6 18:49:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704103 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 44F98138C for ; Thu, 6 Aug 2020 18:50:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6D47B2224D for ; Thu, 6 Aug 2020 18:50:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W1Ns8dk2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D47B2224D 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 D64066B0022; Thu, 6 Aug 2020 14:50:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C9B966B0023; Thu, 6 Aug 2020 14:50:02 -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 B3D6D6B0024; Thu, 6 Aug 2020 14:50:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id 9E8726B0022 for ; Thu, 6 Aug 2020 14:50:02 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 62DA13623 for ; Thu, 6 Aug 2020 18:50:02 +0000 (UTC) X-FDA: 77121033444.12.bell47_5b173ec26fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 2CD2E1800E907 for ; Thu, 6 Aug 2020 18:50:02 +0000 (UTC) X-Spam-Summary: 1,0,0,647277d05e1bced1,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1359:1437:1535:1542:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2693:2898:2899:3138:3139:3140:3141:3142:3353:3865:3867:3868:3870:3871:3872:3874:4321:4605:5007:6119:6261:6653:6742:7576:7903:8603:8957:9121:9413:9592:10004:11026:11233:11473:11658:11914:12043:12297:12438:12517:12519:12555:12679:12740:12895:13166:13229:13255:14181:14394:14721:21060:21080:21324:21444:21627:21666:21795:21990:22119:30003:30054:30070,0,RBL:209.85.214.193:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04y8thwt1d67gwfbirm6enz3pzzuxopwufk344gf34umukd8ucfrc3ajgd87a3r.jnt5yzqfs54khiydnzrkzyeqr8ycru83bz3kbkfaahxkhcrd37913rzf36ugr8w.w-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: bell47_5b173ec26fb9 X-Filterd-Recvd-Size: 5625 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:50:01 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id t10so22911592plz.10 for ; Thu, 06 Aug 2020 11:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v5yJHduIFPrJj0jzu2BdJTc4v9IJtvWAc6ztTF7IVcQ=; b=W1Ns8dk2j6ciQE7pkh/lSVYKDfh0hFrqZoP3hVtMZZTGlngp/JpLTneCwzZN54yKTI 7Q5qCFkyMFLHKhl1U/8xFf45prH3fZeQCbOkgVWiIjrMjzIt8lPsUXBLNVQOhoZy5iVp JJbwgsEy/8Zb5pBfGNMIKe4/TWGFhwYSF9iqoYu4Zafu8GRMC3rc3qhUBHFbfMN4NtKh irkvui7bOYfmuKMdhcn0ggpkX/8kGEevhPOUXtNp+cushrLJDMja6wADSXQD/+WVkOzf eG0b44GKxQBC87wLX34S8hXXb4MVKGuj0F7ZTDnZdIvU/hu299bmVGEYTtyX8VTmdBHA wH2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v5yJHduIFPrJj0jzu2BdJTc4v9IJtvWAc6ztTF7IVcQ=; b=nM5Mtyb/BcdQ/qPVjFAiAyxAjet9EWnjEvBz2q7Pbn5ZkCXilam6eQ2QJBZQLzTVDj iZpCPXokHHtV7RvGxU4IGiliCLtS00kTyjneR54tN3dIgZXrROKdnnFdv9Qf5nHTSOjT 1AnGXFFRSDzPIyRNC/cDSVwrOZKBvBI66L+MBulWTudQ8HTKHmoSdiWjIqz7UPfPMNaf 6wUewoXcFlPg9zQwPIqBUKiRVUY2CVd5MspUYbGyC2Rr+LrFUW+LLXY4JobNnnInQDoZ aNR3gLiMyZSpXTXYLjTxRD8k5Tu1raBwSzzVZSc3R3ttGyZPUCQJPyhM9SJPYi7Zz+/a W3pg== X-Gm-Message-State: AOAM533gsM61RlIqqjSv3a3J+iDLYASCWJqni754dufkfYUSIQGGyS/y bxzI5IB8WlT2rqPaiGIHipFZWSAIrw== X-Google-Smtp-Source: ABdhPJxRi4CrPBcRqCBlogHKcSjI51QQFz3Fod7dvSfzrksrBLVYpPdPfBO9DPZZ0Jp0S+8QsOsuKg== X-Received: by 2002:a17:902:7d81:: with SMTP id a1mr1368470plm.89.1596739800728; Thu, 06 Aug 2020 11:50:00 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:50:00 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 10/12] mm,hwpoison: Return 0 if the page is already poisoned in soft-offline Date: Thu, 6 Aug 2020 18:49:21 +0000 Message-Id: <20200806184923.7007-11-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 2CD2E1800E907 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: From: Oscar Salvador 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/: When 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 a 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 Signed-off-by: Naoya Horiguchi --- mm/madvise.c | 5 ----- mm/memory-failure.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/madvise.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/madvise.c index a16dba21cdf6..5fa5f66468b3 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/madvise.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/madvise.c @@ -910,11 +910,6 @@ static int madvise_inject_error(int behavior, */ size = page_size(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); diff --git v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 3a2cd094b77f..61e20b7dd81c 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c @@ -1800,7 +1800,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)) @@ -1904,7 +1904,7 @@ int soft_offline_page(unsigned long pfn, int flags) pr_info("soft offline: %#lx page already poisoned\n", pfn); if (flags & MF_COUNT_INCREASED) put_page(page); - return -EBUSY; + return 0; } get_online_mems(); From patchwork Thu Aug 6 18:49:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11704105 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 89E0C913 for ; Thu, 6 Aug 2020 18:50:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B2F6E2224D for ; Thu, 6 Aug 2020 18:50:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cV2AEwHE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2F6E2224D 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 1C9786B0023; Thu, 6 Aug 2020 14:50:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 153036B0024; Thu, 6 Aug 2020 14:50:06 -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 F34BC6B0025; Thu, 6 Aug 2020 14:50:05 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id DDBE56B0023 for ; Thu, 6 Aug 2020 14:50:05 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A7E9F3623 for ; Thu, 6 Aug 2020 18:50:05 +0000 (UTC) X-FDA: 77121033570.19.spy63_4b109b426fb9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 6BDA71AD1B1 for ; Thu, 6 Aug 2020 18:50:05 +0000 (UTC) X-Spam-Summary: 1,0,0,e5881346811ac187,d41d8cd98f00b204,nao.horiguchi@gmail.com,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1543:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2899:3138:3139:3140:3141:3142:3353:3867:3871:3872:3874:4117:4250:4321:4385:4605:5007:6261:6653:6742:7576:8660:8957:9413:10004:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12679:12740:12895:13148:13230:14093:14181:14394:14721:21060:21080:21094:21212:21323:21324:21444:21627:21666:21939:21990:22119:30054,0,RBL:209.85.216.66:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04yfi9e5h3sfdhaj1yi5s1irmrfcrycoa4ndhgoh9mb5acijhfn45kj73tpwnqy.afzw44egmck9mj3f1frwgfm4fe6wywczasiawkcujrphg9iqat3yiq415qx6q6j.a-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: spy63_4b109b426fb9 X-Filterd-Recvd-Size: 6057 Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Thu, 6 Aug 2020 18:50:04 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id c10so5101360pjn.1 for ; Thu, 06 Aug 2020 11:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wKkzBXT0A10RMCbmB0sW63A088296XpG9JqckPfziyY=; b=cV2AEwHEAACGSXDXztNlukjitDsQ3Yhfl3T+j5IzNo3aIvL1oYcU54iT2oEJquFGYV EFBO96h6xam0Fho+vRGKCvi0UApaak6sY21ukTsnFDNxC5n163cegZEZtIlGZt9ADWXY x1jx3cmHjERpUV5jKT49VqwepH2d0nTzLPqNH9EiMw3XHNodLfouk0OdFcm4lJ2q0vxx P4mlUuHFaaESzW4bzE/plwmxA60SXFWaxC6KM+q+ogLtrWlrUOD4ArcGvQLSWrfCdBRs 1xyTzT/988nMi1UtYJTeMMyIKYy2ty5ssvT/mHrA8FJm+ndItPFfGIkv16Je8NCHXJDf 88iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wKkzBXT0A10RMCbmB0sW63A088296XpG9JqckPfziyY=; b=McNY/oBzgcqUWVp93483/nvVYE103PsEgxjjHLutFB0ywCE1GepeBLhdYJfUl63+xg R5WLzBwoD0Ro1ePwOOdCx+g06V18/cA06ZjJz2uCdDoSdASWe2FXS1PJNBztZuwf8LMP hRmTmG6MFN8Y2lvzuNm2lcofNr98Ydc8/0kO9vo9vbfWAGnm0q06rUlbOcFlX6aSYV0g NJIbaonJ6thU5di72APjPSUyfqSZU1dXJLNZpDS1uXahdUMiXpP8eYKtMskZYpbvHK11 1sc0K4dQ2ZqCbB7NpKvH1IAUArQq5rZ1JpOSXWsldEpOVMJq9Fzjxich4SfFEhH7TBRw iU+g== X-Gm-Message-State: AOAM5330c9Ma39W/Zq8fCRG6aw79F3+PGxUvXFfaY3sBSHje77vC8H3M aGF4WbAdN1iKlbSM19ZqiI0/rFkVeQ== X-Google-Smtp-Source: ABdhPJwRcKOgv9ZvObyRfMqP+tKa5UG/Urcd5pPbv+ymwa+u3QTNFnkHaQoxC5Mx95UOdPkgbcas5A== X-Received: by 2002:a17:90b:684:: with SMTP id m4mr9827210pjz.4.1596739803868; Thu, 06 Aug 2020 11:50:03 -0700 (PDT) Received: from ip-172-31-41-194.ap-northeast-1.compute.internal (ec2-52-199-21-241.ap-northeast-1.compute.amazonaws.com. [52.199.21.241]) by smtp.gmail.com with ESMTPSA id u24sm9096730pfm.20.2020.08.06.11.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 11:50:03 -0700 (PDT) From: nao.horiguchi@gmail.com To: linux-mm@kvack.org Cc: mhocko@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, osalvador@suse.de, tony.luck@intel.com, david@redhat.com, aneesh.kumar@linux.vnet.ibm.com, zeil@yandex-team.ru, cai@lca.pw, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 11/12] mm,hwpoison: introduce MF_MSG_UNSPLIT_THP Date: Thu, 6 Aug 2020 18:49:22 +0000 Message-Id: <20200806184923.7007-12-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806184923.7007-1-nao.horiguchi@gmail.com> References: <20200806184923.7007-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: 6BDA71AD1B1 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: From: Naoya Horiguchi 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 Signed-off-by: Oscar Salvador --- 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 v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/mm.h v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/mm.h index 371970dfffc4..442921a004a2 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/include/linux/mm.h +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/linux/mm.h @@ -3024,6 +3024,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 v5.8-rc7-mmotm-2020-07-27-18-18/include/ras/ras_event.h v5.8-rc7-mmotm-2020-07-27-18-18_patched/include/ras/ras_event.h index 36c5c5e38c1d..0bdbc0d17d2f 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/include/ras/ras_event.h +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/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 v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c v5.8-rc7-mmotm-2020-07-27-18-18_patched/mm/memory-failure.c index 61e20b7dd81c..bed4b6aac9a0 100644 --- v5.8-rc7-mmotm-2020-07-27-18-18/mm/memory-failure.c +++ v5.8-rc7-mmotm-2020-07-27-18-18_patched/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", }; @@ -1373,8 +1374,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); }