Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5793185iob; Tue, 10 May 2022 03:58:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9aJEI4UjP5L+eqUATEBDGtajbJdjFdV8oYOCwx97C3L9il0FyoTZpW/pibE16xmRAZIvA X-Received: by 2002:aa7:d708:0:b0:427:b5ee:b8f2 with SMTP id t8-20020aa7d708000000b00427b5eeb8f2mr22898140edq.404.1652180299612; Tue, 10 May 2022 03:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652180299; cv=none; d=google.com; s=arc-20160816; b=d2jLAkNYq+JA7wq1MUzMgDdmHYHueahiRj3NpOsRAbGT+FAZWfsjKjVTKrgwMbZAtL F+GxyNiLDDeIX3PWy5o5cxaXFUSVimthYpuWDeWuO713u1/wrn0ZBXsQYQz2/XPHPgyY aUm1xdAGYUjPK5qToHqZMoYMSP9/GEjzaa2P2whtncSKp2t/AFEEgdscNGfiBp3tn0n1 EmlHr24IVpOE3vIUY91ubT6Rq9jwZ8/NcOV/A47Ooczd3U5QpemeXiCQSbYCl/kk9d6N 41eyAVxFOErz1lRM1I3CasU49m0uxuW2bNyxVSbKv0bCuGI7Na3kKgtkxq5PRzChh+Xy vGFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qVEOoGsIlooEpfnjcilZ8EKGRE3sSWxS4g1FKGjMuzQ=; b=FebtjIrHQjYGKSvj1+KC/8JRqQ1U9iEiIxwG7GaAwEycVE1mW4N+de9ZBccTAZjH9d 2LOD7V4fl1ZNgXizBdh5Sxrd9XwimT834OTaKvt0kQJmSCxqXEAKejNOiLPMxWOQjSEU /w587X/livL606MuqDpDw/zF576DbUtRf5KnZb+Sr72pknj3gAdr3XyTRsdyu+rYmVPh GbG/F8ZcDDimpzaCNaJOGZoVPtnPu4mCYPX2KHkHsOE7bR/0tXVUg/Rwohyzo0CuH6YZ GFQBmJ1JmLMmTZeVqkhisEtupA7T/UpeH+xUTkimsisVGpJQnmoH7oeQx4exHfZniH7S c/dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sghlFxVg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 1-20020a17090600c100b006df76385ee2si16139037eji.898.2022.05.10.03.57.55; Tue, 10 May 2022 03:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sghlFxVg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234623AbiEJCc1 (ORCPT + 99 others); Mon, 9 May 2022 22:32:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233963AbiEJCcZ (ORCPT ); Mon, 9 May 2022 22:32:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 070D31A8E3A for ; Mon, 9 May 2022 19:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qVEOoGsIlooEpfnjcilZ8EKGRE3sSWxS4g1FKGjMuzQ=; b=sghlFxVgp9mMCsYDnyEhX8rGzt pODjDgmXBMdUHve+PBFiy6rLDIwmRC08E6XgoQc1VWp8FNzeGJyrZNtGAVmRkEyWLM3AhW/GUjKiw PAlqx3UV0l+rmimlsEHElHfBjndfPCLoHgEdjQSq/0ZJ3K+hyOmuRuWRXv0JOfbgCVAKq3hFopcWR uHntW3bn3MuaAZjzMyiE4/igsw9Ak6Ym13OPF9Z+csD2dH2FL2n/otj5ZLFAj7oawg3onTPKjbY3i /8GifdJP/gsGEMfqQXHlh6vozZOEfKVst+IzMfXe6rsO1dBDqlp8AUJyGIPHKPd5DVYx3Tdnlvaoc jDBWdb9Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1noFbZ-004177-LN; Tue, 10 May 2022 02:28:05 +0000 Date: Tue, 10 May 2022 03:28:05 +0100 From: Matthew Wilcox To: Naoya Horiguchi Cc: linux-mm@kvack.org, Miaohe Lin , Christoph Hellwig , Andrew Morton , John Hubbard , Jason Gunthorpe , William Kucharski , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/hwpoison: use pr_err() instead of dump_page() in get_any_page() Message-ID: References: <20220427053220.719866-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220427053220.719866-1-naoya.horiguchi@linux.dev> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 27, 2022 at 02:32:20PM +0900, Naoya Horiguchi wrote: > From: Naoya Horiguchi > > The following VM_BUG_ON_FOLIO() is triggered when memory error event > happens on the (thp/folio) pages which are about to be freed: So the real problem is that we're calling dump_page() when we don't have a reference to the page, right? Otherwise it wouldn't be freed. > out: > if (ret == -EIO) > - dump_page(p, "hwpoison: unhandlable page"); > + pr_err("Memory failure: %#lx: unhandlable page.\n", page_to_pfn(p)); It would be nice to get some more information out of the page than that ,.. but taking a refcount inside dump_page() conflicts with the other "would be nice", which is for dump_page() to take a const struct page * so we can (eg) make folio_test_uptodate() take a const struct folio *. We've had some other problems with inconsistent pages being printed in dump_page(). It can be quite confusing when debugging. I still don't have a good solution to that either. I do have a proposal for reforming mapcount which will solve this particular problem, but I'm not quite sure when I'll get to it. This patch is probably the best thing to do for now.