Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp653071ybt; Wed, 24 Jun 2020 08:04:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfcksrsy3WyeG9TupoPaceCHJ3B2xF72y++zSnfT70cJbdE7gyWyam0cVjxJW+UBIolOnN X-Received: by 2002:a17:906:a28b:: with SMTP id i11mr15991889ejz.524.1593011059372; Wed, 24 Jun 2020 08:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593011059; cv=none; d=google.com; s=arc-20160816; b=CjaTdCvUKgSC9LGP/stF+o6CPrDoAZqlCCqeM1+vTQRc8HvLiV7iRWrqsD8PlTsq5O zcwZvj71frZXzOn8IdQXi/de0jSld3GaeRaI/XsbWKEEvt4jJRQrf50sJnw0A8qmZi8t YKP8VxKtKmXBbbpLrV+H+ovM3bfOa01ZTEUip31IzFe91Qp+GDLTIM5LXSRAxt4/6gw+ ZB5vnrakQ3LR+2AxngZkGyGdx6zcqtaRxfd5QueIcYRkGCeoPHcgIKXpH1Z6PYaCeC+X rU7eSBi4qtq8cTcTLh9tUZl2KT6I98TIQEFxIckvsVq3w97Y1THj7xKsaSi0bbfSsnpi Uedg== 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=vGo//y2piUItDtCt+d69yjROMahecLhJLYlxuCdPjdw=; b=HDjMlSOt/YEILt0VeCc+8cEcSEKG4IGCEmRiAMIMq94pDoMWCPoHlTzCe4TvcVhOjr LxBoIfwUsy/eyGPAa+LtaMqTJCXb3EoFKgj5saRElO16QfJlBEpXYZMRcoccpb1dvaNi EpLFMcyAD6Yxj0WY7nD4oLQ09aELDfaYRWru5k629JJ/kXBmUTA/6nydOE2CY552SOlR 7JilEMFYUSyI6xXcFYNddEKUHaIedsB8JBg6aSIgXLJMfkQrhrLbxKWWoboIQCHzTjvI 9WTvT1lxKC5jfWnU34EcTFBAptvJoFDrcYgnWBFfqsmBADRAQh1piIAoBmze7oWxu6I1 UW3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SMN95lFx; 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 y10si9205175edr.504.2020.06.24.08.03.55; Wed, 24 Jun 2020 08:04:19 -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=SMN95lFx; 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 S2404290AbgFXPCu (ORCPT + 99 others); Wed, 24 Jun 2020 11:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404189AbgFXPCE (ORCPT ); Wed, 24 Jun 2020 11:02:04 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BB78C0613ED for ; Wed, 24 Jun 2020 08:02:04 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id a127so1259343pfa.12 for ; Wed, 24 Jun 2020 08:02: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=vGo//y2piUItDtCt+d69yjROMahecLhJLYlxuCdPjdw=; b=SMN95lFx/w+d9J9q5fXpWkMsl0nkfj3ahdWd28iH1Ej/dL3bnERwMHyy5qBJbdrZf2 TgTmvvBIpqABHJxq5+W9AbgRwEShymOKxVDS4wnRWAc2DiTu2w06VUWp3C+C/waieroE pS/xnD56tSFnRmyV30RS1PF1NjqjwcLUNX8PBQ6A6RFxzTYi47CEunCvUfliYKDmAjAv PH5cMk5eD6anBAeNV1OYRdBei0IF3DS11++j797nnqxnuzZiO33wU8t2Yhsgsx7aUwY2 xOO2H3X7tbqSCdc5x8Imoi4zbnlE10C+FBk3DBxKKUwdtSZqLeBP2zSrAR/iYsOpa9VS 8Z/w== 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=vGo//y2piUItDtCt+d69yjROMahecLhJLYlxuCdPjdw=; b=Nc2VVMb+GP4N5ERjKKcx/L9RuTMAdH/R3KVpD2w4VW0vVRB/9pMjTihBdv2rGEtwL6 DYMBcMKdndVBy8A3YfCrNWI5/sk8x63RLGz+N15vyUkaNnVjbpB/nfwM0JvBBhC2ezvD KVyf9SiuJREklym2HR41bGfhDu0CU7aiS9S46ziZ2IY9ZzawhTrgYIMcN9ffxNxQNrMb Ny5UA1Y/5N/OTSFcRMtR53bRYZBkLQ0Le0Qm8c+t2fw1AsN0mMGLVLX2uu9kRo4N3HtF INqr7O8T1+KGIZ4Cu9mZZuuf7YLssrSdFtBmhpc6KpCSDOISzAjpBqXE49ql2E7zMNoZ O0nw== X-Gm-Message-State: AOAM531vK27XYuNEGLOZPXwWAKw4gYsqfqELPZkOvjBPx9qtOYbgOiHQ 4ZpJ5+q11DvF183hpzzN1A== X-Received: by 2002:a63:fc1f:: with SMTP id j31mr22657214pgi.104.1593010917772; Wed, 24 Jun 2020 08:01: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 i125sm17013705pgd.21.2020.06.24.08.01.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:01: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, naoya.horiguchi@nec.com, linux-kernel@vger.kernel.org Subject: [PATCH v3 05/15] mm,hwpoison-inject: don't pin for hwpoison_filter Date: Wed, 24 Jun 2020 15:01:27 +0000 Message-Id: <20200624150137.7052-6-nao.horiguchi@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200624150137.7052-1-nao.horiguchi@gmail.com> References: <20200624150137.7052-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-rc1-mmots-2020-06-20-21-44/mm/hwpoison-inject.c v5.8-rc1-mmots-2020-06-20-21-44_patched/mm/hwpoison-inject.c index e488876b168a..1ae1ebc2b9b1 100644 --- v5.8-rc1-mmots-2020-06-20-21-44/mm/hwpoison-inject.c +++ v5.8-rc1-mmots-2020-06-20-21-44_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