Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5503363ybg; Tue, 22 Oct 2019 04:21:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFFYaVMQu32ddPKyFdu6KEZWb8iteLJzSTleRXInG86t26JuZ6tgaIgLAe80r9qY5Ja/Ai X-Received: by 2002:a17:906:2ada:: with SMTP id m26mr26530426eje.87.1571743270834; Tue, 22 Oct 2019 04:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571743270; cv=none; d=google.com; s=arc-20160816; b=gBw9oucckve1E9cjLxYTkuVnlFBZ+vK3e738dJ5Frh1lW2AhdWcp2qpgQ83uktReiq VVzd/24W5thXv9BwvPe1z5LrxdL3UwbHfIaTsDWHwzC3vT7o5LkkhvKz5971YFeSnFH/ Ag3TuO6AEEUY9cwh6xnuDwBxAw/UDq24hjsU4efsZ5SNXh2+SExjRb9HBSfhZVJhiOOE N/TePjGbDPBKyXFdQVARyjKZoClLPGZmDahWV70dfe8zH6y/pxrv9p2OJn2BOf+wrmI0 IyXd6sLui5dO0EHJLRLvkfY4jfvhTCkPw5Mf/m0Wo7SgCfcEqAQMfK60tjAvFfN3R4ZS 7VdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=liICzCSqGxpte6XYSxwNSaTSJVLaqgidhcfB9odOYFg=; b=UGX8sM2EZAW7q5/kFuGMjy59xVYPpYFx7WmWpXUTh1Tjd0MMk2VxGpKXRrfj7Hi0cd aCZpF/bWF44bWJ6hogEuC75pCEQePQL8XV1UrubTmDoJLr7maw77fJAvYfTCjtldIBsM GbSWqH0/QNc9GWQ9+vGFnTX+EwjLJvIW/Qav3QMZIvt1C3kDvgB9/HxoesNGQd7nJ5RB 260J2bLbQa6XAvwpSME/CCHSFm3VaEMJKoH2YQI5jE9eEZr3XsfSIP1gv7GT5HkDWbrF pZUosvaQWrPH0gVAhCW9mDtGnszAFl3TjyQNSLAe3rsO5gcbsF1NrE2n4AS5nCgKEMiq 1zYw== 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 c14si10480921ejz.242.2019.10.22.04.20.45; Tue, 22 Oct 2019 04:21:10 -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 S1731007AbfJVH5t (ORCPT + 99 others); Tue, 22 Oct 2019 03:57:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:48178 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726978AbfJVH5t (ORCPT ); Tue, 22 Oct 2019 03:57:49 -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 7B15CB85D; Tue, 22 Oct 2019 07:57:47 +0000 (UTC) Date: Tue, 22 Oct 2019 09:57:45 +0200 From: Oscar Salvador To: David Hildenbrand Cc: n-horiguchi@ah.jp.nec.com, mhocko@kernel.org, mike.kravetz@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 15/16] mm/hwpoison-inject: Rip off duplicated checks Message-ID: <20191022075745.GC19060@linux> References: <20191017142123.24245-1-osalvador@suse.de> <20191017142123.24245-16-osalvador@suse.de> <1aa1f09a-1210-d0bc-86ac-9674828bff49@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1aa1f09a-1210-d0bc-86ac-9674828bff49@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 21, 2019 at 11:40:39AM +0200, David Hildenbrand wrote: > I explored somewhere already why this code was added: > > > commit 31d3d3484f9bd263925ecaa341500ac2df3a5d9b > Author: Wu Fengguang > Date: Wed Dec 16 12:19:59 2009 +0100 > > HWPOISON: limit hwpoison injector to known page types > > __memory_failure()'s workflow is > > set PG_hwpoison > //... > unset PG_hwpoison if didn't pass hwpoison filter > > That could kill unrelated process if it happens to page fault on the > page with the (temporary) PG_hwpoison. The race should be big enough to > appear in stress tests. > > Fix it by grabbing the page and checking filter at inject time. This > also avoids the very noisy "Injecting memory failure..." messages. > > - we don't touch madvise() based injection, because the filters are > generally not necessary for it. > - if we want to apply the filters to h/w aided injection, we'd better to > rearrange the logic in __memory_failure() instead of this patch. > > AK: fix documentation, use drain all, cleanups > > > You should justify why it is okay to do rip that code out now. > It's not just duplicate checks. > > Was the documented race fixed? > Will we fix the race within memory_failure() later? > Don't we care? > > Also, you should add that this fixes the access of uninitialized memmaps > now and makes the interface work correctly with devmem. Thanks for bringuing this up David. I guess I was carried away. Since I have to do another re-spin to re-work a couple of things, I will work on this as well. -- Oscar Salvador SUSE L3