From patchwork Fri Nov 9 06:47:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 10675369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41818109C for ; Fri, 9 Nov 2018 06:47:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 311252DD3D for ; Fri, 9 Nov 2018 06:47:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 257492DD52; Fri, 9 Nov 2018 06:47:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B078E2DD3D for ; Fri, 9 Nov 2018 06:47:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BAF2D6B069C; Fri, 9 Nov 2018 01:47:42 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B32386B069E; Fri, 9 Nov 2018 01:47:42 -0500 (EST) 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 9AD526B069F; Fri, 9 Nov 2018 01:47:42 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id 44BF06B069C for ; Fri, 9 Nov 2018 01:47:42 -0500 (EST) Received: by mail-pg1-f199.google.com with SMTP id w7-v6so634483pgi.3 for ; Thu, 08 Nov 2018 22:47:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:from:to:cc:subject:date :message-id:in-reply-to:references; bh=9DJFcKlJJiJ+Adjp9pPwaHOqo/nJGemRGYZuMELBj8A=; b=d5H3mqc2CcL4gjdnzDtddsOMHAw79OiAh7BWVsZK03HldGuDJPE2gyxnGjV/QiiNuO q/F1LA6FIZXoVj8LJipKUpas1iDUqcScY6U2++Sq4fvhcSFM1z2cycO6ojTemjzdoVzY twIEOKFXRuIG9pSaxgFqJyFj+AXjOKQw4cGhmnGv1IOrI4AjaZQWtZot7gY1PUn1Sk6k SxXvhWyMiU6lQWMLDixx9aXrEs24hWtBJi+LWSxr4CUy0HttPGsAHB43iBlna0lpedKY 87CVosRlrMMLe5to4JZfszK59dOcpIHBRIBp3kNB4AjBWk8HNWsSlObfg5m9DO/ShkxN 6QIA== X-Gm-Message-State: AGRZ1gKQyEzcQGyN1L6pRmqoL81ZrqNpVGPZh5VLUg+HCusG97yXXJ41 bucFUerLs4aS+itKLI+XhTSX9FJunF9KzuRbe35lDvbojZusG2Tz/DtDRBBixlJHop0OvZr3nbb hn84FqPkj6uLeouGAUeZmve+3bwFeTcT/nwn/GPxTRei+11e5TAUcJrRyDzqpqWUkf9nWxpq7uH jcGk4kHhEFdqGvR94At2J8JLntNWaCm4fpfeFtds76ikzUKT0G8LwRY2BqPebsb9Hw5BAPBi1NQ JPMqE4YnuPx4QzFZS4hW0CU49IWXlCuXuxy4GKBiRBPyN+Srdkpna0GSaLxXBw+eKlCQGyfuYux UGdCWhK7Lxyc7QNjWyJfsh6tM5y5aZGulYXDmomZ1c+kxC44nY6omRpiqROSfraqZcaKmhjpDA= = X-Received: by 2002:a17:902:4324:: with SMTP id i33-v6mr7849033pld.253.1541746061951; Thu, 08 Nov 2018 22:47:41 -0800 (PST) X-Received: by 2002:a17:902:4324:: with SMTP id i33-v6mr7848992pld.253.1541746060615; Thu, 08 Nov 2018 22:47:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541746060; cv=none; d=google.com; s=arc-20160816; b=YoIo2tsv6Xm7QWxVxTHshIA8yz2AL9wOd57FxgGFld0leYNfSSfbRO1fTUysDEFcFB BFotNC46xIg8zIoLYXX3mzpy/4o0EkVUjc5DcYHQMVg9c8WhxhanYgU5dmzy860fZ2RA 5QxQ2C2a124DoGSq0JFoxQUq6rqLpEbPOAWBG7HvF5EsKn+EsIeewrnLoetsDrVyrwIz uGsKy3RBjq1EqR1WcvxlC1KyDbpKQEa+RyPgQxe2BB6hAryRhxo+ujth20cDEnh67LzX bDD//9eAxBfHa0pEhsX7MWWGswOj4w+wAT6tbDVYK0eCIurXo+ESjNVMt4y7I5wNzjDT HA3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=9DJFcKlJJiJ+Adjp9pPwaHOqo/nJGemRGYZuMELBj8A=; b=LWVkzabyos8X1IvA/uDfqgEdXRDzCBmlroDzpCKGT3YvtH1zBKshw3x9vdnl+rT9wa 9MZpiNFXZMNoJl1218sh2zxpZyMA16CdoXLW3XeR2WKsdisGNsQrN0NYTWObpcY7WcJ8 fQhk0Yf/iratXxXFii1b/YSC7tQeawoBLr7/CQy1YlxQKMeNorzTPYo26aRT06P7epam WdXQMjwTzXxZlzpYxASDPpFc9l1XMxm6S6wNfnqVZWmhCy5ZmlWXFcSQhOUO6t7IMwy4 QissyVOHR8Z3gSepMj+JWI8+wSLQHLbdNGWbZwgtygHoAtdBa6b+gbrhp6lXWyMvhyQw sQlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uQCid65T; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b1-v6sor7829870plr.70.2018.11.08.22.47.40 for (Google Transport Security); Thu, 08 Nov 2018 22:47:40 -0800 (PST) Received-SPF: pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uQCid65T; spf=pass (google.com: domain of nao.horiguchi@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nao.horiguchi@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9DJFcKlJJiJ+Adjp9pPwaHOqo/nJGemRGYZuMELBj8A=; b=uQCid65TF8sng2YSSfz4J4DdW5Or8lUZ8VX5K8FXmbK6ie7EpUB9Rg3E81Z+ZKzh75 x6JxMb8pw79ckVogFV5IJd81nJcjoRBj8XA1tHzURc5tneRQ+HUDfOmAGmw55jjyUvEs YreOhgU4/Z5Ik2lxFQtHDiZDyge5PiquAMF1aEh+rk9diamSA/koWheiesZ0itasdbaU 97yU45tEDNUYzpEYS6YNVdzPIMJuED/OZiuXFD02YW1fHBAJhy7TbDse9LQpH0lpv3k8 udtveFHnbfRa2hyqcL747oEIj/OEb0NvKWCyy+5Yl1DLCTDWp8WKBQC8O2W6Cw4YxCdz sy8A== X-Google-Smtp-Source: AJdET5c18VaLRA2NAXOA8WsQgpjRuBVfBbcG23XHcUbq5h80KjAALEeN9ruRMTSSaEPaypfq9ccq3g== X-Received: by 2002:a17:902:8486:: with SMTP id c6-v6mr7466272plo.119.1541746060224; Thu, 08 Nov 2018 22:47:40 -0800 (PST) Received: from www9186uo.sakura.ne.jp (www9186uo.sakura.ne.jp. [153.121.56.200]) by smtp.gmail.com with ESMTPSA id c70-v6sm6808355pfg.97.2018.11.08.22.47.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 22:47:39 -0800 (PST) From: Naoya Horiguchi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Michal Hocko , Andrew Morton , Mike Kravetz , xishi.qiuxishi@alibaba-inc.com, Laurent Dufour Subject: [RFC][PATCH v1 05/11] mm: hwpoison-inject: don't pin for hwpoison_filter() Date: Fri, 9 Nov 2018 15:47:09 +0900 Message-Id: <1541746035-13408-6-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com> References: <1541746035-13408-1-git-send-email-n-horiguchi@ah.jp.nec.com> 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: X-Virus-Scanned: ClamAV using ClamSMTP 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 --- mm/hwpoison-inject.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git v4.19-mmotm-2018-10-30-16-08/mm/hwpoison-inject.c v4.19-mmotm-2018-10-30-16-08_patched/mm/hwpoison-inject.c index b6ac706..766062c 100644 --- v4.19-mmotm-2018-10-30-16-08/mm/hwpoison-inject.c +++ v4.19-mmotm-2018-10-30-16-08_patched/mm/hwpoison-inject.c @@ -25,11 +25,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; @@ -39,23 +34,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)