Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1623856pxa; Thu, 6 Aug 2020 11:50:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAbKwL59n1tlqSpMmfmKBWJJwG2gs6rx5Gsxl5pBwZblve7iuKf7ij34k9EC2FIbfa95K9 X-Received: by 2002:a17:906:3c02:: with SMTP id h2mr5878950ejg.437.1596739823834; Thu, 06 Aug 2020 11:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596739823; cv=none; d=google.com; s=arc-20160816; b=sD71crcX8HKgVzISgGPjdrXmIVr3+2gXjgY5sgZSwjBtjK0Y3PAcC7/w9oPvkWzAns 6X/g26apf70YSRS91ls8w7dYQnD/7ILVbWG4ZAJt0Dt2A66T3M6zXnOaldS+E13V7gWX W+pSLc43fTsvwh6TLMrq21mvp0DG4ogeZJ0c/Yyara5C7bnEXne6pemlaUXURdemU931 fvxlwLW3upYmnlrQ53RxnMxbV21z2t/iYeJJ1pRPD7gyfprNNjrlcQCvuVsgDOOi6ejs ozdBkNGKJvpulbLt8uRn8JkzNLYoShVfoRq3UpL25WXCiJeST0JWybcn39Ex2RuYWLnR xG9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=D4Ndr3lMfGWryT8BpcCBWbkT9Sd7Lw+5S6mzuxOjqm0=; b=pqxHLw9CpamIVpe9hYTA08HOc9ADprDJqkSFawSTnjtIZRdev42prR0bMICiGX0eNB w5LPfJuGcY/YCLvi+9D8OoY/UU7kVbijvnzfqvkDQVNE6zQ/qwAoDTQ5edbkdr3U2hrN HXBNOUXGXvEV5Xkz4kXXTlTMnmVaRxwNONCLmE94qwSIIV7wI0QvuuikmGvuEKzd8NKP aMfhezBNztrab8q3pfWHwhFp6XoEozJUlEsggEQGpACf/DbhOhdhhZn/nyjPdeYoStkX bcq3IgjlExhfkTp2XL6uLAd1Xpscnk9Gzo0qpG5lVLwbqkKIPWaiDkKkklDei2e1RxR8 sJWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ii2xA4EL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si3936485edn.543.2020.08.06.11.50.01; Thu, 06 Aug 2020 11:50:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ii2xA4EL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728794AbgHFStk (ORCPT + 99 others); Thu, 6 Aug 2020 14:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727878AbgHFStj (ORCPT ); Thu, 6 Aug 2020 14:49:39 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCDCEC061575 for ; Thu, 6 Aug 2020 11:49:38 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id h12so806357pgm.7 for ; Thu, 06 Aug 2020 11:49:38 -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=Km7PMwOKrYkS9xSkwx5j76LH9L7kM+wSN6U8+mp8/8a6JK0VJa4TNVYeeNk6BljqJV uj0yuvY6iD5HAyOHfETnX3ugz5lgwnXEbJGBqKMnxM2evL9zNiFz9H8tX/pUC7kt9Wq0 0uNzmH6QpEfp9ORIf3DI0pAmsrKtSMGTlZ9/Ve/Gr4cX8c9OE/Qkat6LAU0yslU31lrQ AkcdnvTOFr2yboOXpwEtD0w88UrdOnyL8pxO5OW5U3SHWtpfCM/WCFf0Uq2X4Dh/0GIO tFyalWNI4Mf6hggUEjsdpGTh+OeRyG3wmp+J0AJVfgDPSMU/OGYgN41E6TAZluSrW1af WKFA== X-Gm-Message-State: AOAM532mkRlFNkKI2i9rBPWxda39L8qU01ZAlz/sT4Zi1bRUzXiegSnE N1WWJnzS1DeBxWPBjythEQ== 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.17.1