Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3265577rwp; Fri, 14 Jul 2023 22:15:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFEEcT5PjtaFwqzOF2CA8ONLxuSuOMX5/xiQZFStGATAL5DiVq7iR0OLORp9m4RTXBKdzRB X-Received: by 2002:a17:906:7a4c:b0:993:d90e:3102 with SMTP id i12-20020a1709067a4c00b00993d90e3102mr1105925ejo.6.1689398106553; Fri, 14 Jul 2023 22:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689398106; cv=none; d=google.com; s=arc-20160816; b=HG2FRPShCU+owQZYgy7TA093FS5zcV0OR5B+71QYr8ygJV9Pr37IlvfNV7LHm2ozDR /8IYaM82DVisSGbA7WtZFpvSb/216sXo4lew89fwDSwDx0zfLBtbQpMz60Sw8KNnbH94 gUb55juLCQkyM13w5DbvvrX4XesrpR1FhHXK7EO5IQbjwsGyV7nW2E7LdeoanZihjcAV ZiodVI4IKdoGKVwwo7ng1ezFrPhGP7LJ3HJ14GIFar2hk7yGMgtlFilNa02K781n8CZw 0gFWWKxHdeLpR3glPif3TK6LpqxSpUar4N4ujIuqCDLSHmuXjLWliSLq/XeFfk+FuHfI Tkow== 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=E6BKvalc76lCISIlkA/GnH7FAR2tEutl4Xg0nyimIoc=; fh=xpqZ8ufwZL3Jh7eTztF//2eqJgxjsO0Sre4tXtnSEvo=; b=V320fpO5PPfLCAZ0IyVSp47IWzpDdkLE4IiNZPJ5yfQnyuSnDDswLIPhMLGWoIMzJ9 PQf/4biheC0phlUlmkavuvw+/cOIIlHv7xfm1AiJZa0VmJG3f2X4TpQntZopgER4d+my DG/z43tsskQ4ZAfdGAnDxE49TkUUeTCT3hN6UVnfi7eZ3F3443hso2+qxeScQqEh3IRj FPHyRMzo0cEvvKuK2PSRL3AOEYsZX2Lpqqk85pSCqAXpbDOOz6SgtjirwKU3E5ZSJ22d bpxkapGfDXXF8LDJ/mjgAt4TJODmLH+k88xxH7ShV20oOoVrg8KL7hs2HvHhvPg9i7ho rB+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=q2aBEUe+; 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 h15-20020a1709063c0f00b0098dfd35276esi9336849ejg.1055.2023.07.14.22.14.41; Fri, 14 Jul 2023 22:15:06 -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=q2aBEUe+; 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 S229709AbjGOEHI (ORCPT + 99 others); Sat, 15 Jul 2023 00:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjGOEHH (ORCPT ); Sat, 15 Jul 2023 00:07:07 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 935363594 for ; Fri, 14 Jul 2023 21:07:06 -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=E6BKvalc76lCISIlkA/GnH7FAR2tEutl4Xg0nyimIoc=; b=q2aBEUe+ad0PVFePYgpW3j8qVg JLhgMydUFQrcarZZZCVOjLXoQQHGERh1YmHzeA8176T18gNQZrgPZsnYU3/YrLlS2fvjAywmBoxqH NuEWQrba1HvD2dUgLOqtKOJOtsXHeUipp3iSy5EKNkP3Or4GCj2BpilAExEHslhQ++NP8njkowJ/s 1Dqwg1lLn9Kib+F/TVnLRPiRaSauh6GpHfAT5vLuvyrzSwElE+6nEC4gD1ATsqnDgBWSd42hyDht4 tH5rxTuYo52MT6MtQqAalwfUckXk2w5ND2Eh1RBfwjGcgeCZJKprKPOXV9RTnEQmUukxDZKqQr+qg 6/XTXKhQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qKWYh-001oOJ-DQ; Sat, 15 Jul 2023 04:07:03 +0000 Date: Sat, 15 Jul 2023 05:07:03 +0100 From: Matthew Wilcox To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, linmiaohe@huawei.com, naoya.horiguchi@nec.com Subject: Re: [PATCH mm-unstable 8/8] mm/memory-failure: convert unpoison_memory() to folios Message-ID: References: <20230112204608.80136-1-sidhartha.kumar@oracle.com> <20230112204608.80136-9-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230112204608.80136-9-sidhartha.kumar@oracle.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 Thu, Jan 12, 2023 at 02:46:08PM -0600, Sidhartha Kumar wrote: > @@ -2348,7 +2347,6 @@ int unpoison_memory(unsigned long pfn) > return -ENXIO; > > p = pfn_to_page(pfn); > - page = compound_head(p); > folio = page_folio(p); > > mutex_lock(&mf_mutex); > @@ -2360,31 +2358,31 @@ int unpoison_memory(unsigned long pfn) > goto unlock_mutex; > } > > - if (!PageHWPoison(p)) { > + if (!folio_test_hwpoison(folio)) { This is wrong. You need to test the individual page for PageHWPoison() instead of testing the folio. I understand that this will work for hugetlbfs pages, but for THP, it's the individual pages that get poisoned, and folio_test_hwpoison() on a THP actually only tests the head page. Ideas for preventing this mistake in the future gratefully received.