From patchwork Fri Jul 31 12:21:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 11694835 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 DFC62913 for ; Fri, 31 Jul 2020 12:21:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AC6F82087C for ; Fri, 31 Jul 2020 12:21:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ox0RjpA1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AC6F82087C 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 989C08D002D; Fri, 31 Jul 2020 08:21:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8C1648D002C; Fri, 31 Jul 2020 08:21:35 -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 787508D002D; Fri, 31 Jul 2020 08:21:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 52F1A8D002C for ; Fri, 31 Jul 2020 08:21:35 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E6DDB3626 for ; Fri, 31 Jul 2020 12:21:34 +0000 (UTC) X-FDA: 77098281708.04.lunch46_3c0feb226f83 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id B6339800843E for ; Fri, 31 Jul 2020 12:21:34 +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:1534: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.216.67:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100;04y8u9wbyrmjk6biok4aex663zdyzoccbp5i7uyqe1m89uyxaqwk7t55gyckrjo.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: lunch46_3c0feb226f83 X-Filterd-Recvd-Size: 4996 Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Fri, 31 Jul 2020 12:21:34 +0000 (UTC) Received: by mail-pj1-f67.google.com with SMTP id e4so3976589pjd.0 for ; Fri, 31 Jul 2020 05:21:34 -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=Ox0RjpA12PJQHDITrdph5pOPcuN2GYXZFDP64O1Jg7Q9hHYJqG0b6qkA1DyLT1HCYA yAIAN9doa8ZzugIrAzEWwuyFfOELJ5kmOooR2FsMap3TbEF94piK1e/wcwC4z7k40eXD clWp0mC2ZCqtXIDvB1CzQ0PHfEixXvYcXb39QIxCU0XAIWo9nRhM6b8rAVWVSt4pdr1p CCpQPW7LRf5H85Yp258fUIC3WPDfZKKHL5AXw/yegUQzvD/xA1eFx09vK7HleoosgXCo DNp1KFajA6j0Re9O7hiQ0JAZ2xSIezel7P48RxdqtF86SMVg/VzFTdJLd/KqtpLARV4y RM5g== 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=duFVJP9hya8DQVjzR0ds4SiOo4BY1QnxWZVfc147c2st18KZ3/PvtrgizrThLmS3rd ZTiZTRotJZylfr3J+ln6DLAZg8ro43bTeD1q4K82+8FrF1ZpGz0Wn6CsadrUmddQW575 oBdiJTPtlo1BGtkUZzlaoTqxWCPgW2D0I1an4/+PGbi6PvGYk2RA/8YXHWPDtzeRTaew Dn75Q05tgregC5FIPSk9AJNaWEIcr1F4uyw5jLQlo2IO6SEPLrfbvuMELLE4hpCLxkWR R32jLJxa5qAxOinsLvglLrFWZiBOKlKiMLYtwJ4em5Yz0nXzyvTDg6zejuG1e0KfDuwk 63VA== X-Gm-Message-State: AOAM530mXsgQhqc/E2gjNxmEj4wkThLA/VdeuT10/qQDoNAVQZhXB+9G 1ksDsFhRtZjBdim7xZ8UOKpG20cfCA== X-Google-Smtp-Source: ABdhPJxsym233zotubkKtsT7WOGGC9czTkxCbghBK6umjx1A55M6pXrzAXib/Mcqh7ouG2Jv74/uoQ== X-Received: by 2002:a63:df03:: with SMTP id u3mr3359540pgg.84.1596198093503; Fri, 31 Jul 2020 05:21:33 -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 m19sm3675692pjv.34.2020.07.31.05.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 05:21:33 -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 v5 05/16] mm,hwpoison-inject: don't pin for hwpoison_filter Date: Fri, 31 Jul 2020 12:21:01 +0000 Message-Id: <20200731122112.11263-6-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200731122112.11263-1-nao.horiguchi@gmail.com> References: <20200731122112.11263-1-nao.horiguchi@gmail.com> X-Rspamd-Queue-Id: B6339800843E 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)