Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1141201ybg; Fri, 18 Oct 2019 12:42:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4gE7MDJw45iaB43NSAdO9w2gEmV3vjEM7EFWL9E9ENF11oLWMrERZKIbYxA+YL49N8vZT X-Received: by 2002:a17:906:19d9:: with SMTP id h25mr10182028ejd.297.1571427731467; Fri, 18 Oct 2019 12:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571427731; cv=none; d=google.com; s=arc-20160816; b=iKGmV+n4cGEbXB/mb8NJ6mYWO+2Wxs033m7wsXnEaTrWrNe+Xeu1uvyl/5M076O7aZ R2f2IiGPz6FE+rLohpYcPGvSrPvsdyJu1uAVXzVyEpb8acP5mKdfEoB4E08pRbaKWMTI tyKeayLCBtwLjwRo8We/Hh2nu42gvXDM1Q8eFOZhRSYzJTaHI/FG5MiRnkX1eG4fRNZ6 SBjfp7YoR9PVT0lqSx3xH2yvYuHosPs7/c74BS3otWoy1cMlvqU5M5g2rWHrZr1Ha6Ad abC3NC+ca61BMICMYJM6jQaBLgTU1AUWLCAO7TVVZGK5D3Xr9pk7FNpZ8ddYuwjRlEof Wo0A== 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; bh=n1w3DgDnu4u12IZP7wYzzzK3V//ePVPENqbxybD++Z0=; b=LDoevrLxvfk5clW5dutP7A8qaUAY7wCq/tVzDtP+H5tWhIZcKkFLq3TbDA8dj5vWxD dUycBIaugn1PTGVQymHkQnNhuF5DQvOHAPe2tYY4LPip6zqQzQRE+02bf+nyu42q7VnJ SOx8QDrhEbhmQ2p++mvZj8oVCo4wrc7jSoe7L5RErPzzwHteCHcC1u37La5nv/2t0nuN 9sACixB+ohpqPQHPtaXVrCrGe3EodgNA6Z/UEmrO8XFFXXQfRawrQMqLjtENoqEee7SE qKZ0OPvNvP1Fq5utiDR0cEkNYHO7ubxdnEAWhsk5Y9q2dfxaG4Lh7VQrAxkxa8i2f2T6 nAKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i34si4805012ede.37.2019.10.18.12.41.48; Fri, 18 Oct 2019 12:42:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2440270AbfJQOWY (ORCPT + 99 others); Thu, 17 Oct 2019 10:22:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:40560 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2440106AbfJQOVe (ORCPT ); Thu, 17 Oct 2019 10:21:34 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7DDF8B48A; Thu, 17 Oct 2019 14:21:33 +0000 (UTC) From: Oscar Salvador To: n-horiguchi@ah.jp.nec.com Cc: mhocko@kernel.org, mike.kravetz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [RFC PATCH v2 04/16] mm,hwpoison-inject: don't pin for hwpoison_filter Date: Thu, 17 Oct 2019 16:21:11 +0200 Message-Id: <20191017142123.24245-5-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20191017142123.24245-1-osalvador@suse.de> References: <20191017142123.24245-1-osalvador@suse.de> 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 a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index 5b7430bd83a6..0c8cdb80fd7d 100644 --- a/mm/hwpoison-inject.c +++ b/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.12.3