Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1899418pxb; Wed, 20 Oct 2021 14:10:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTlOXlYyD6b7n5fn+QEXgm4p08qnqfAt4YwoVM06cchsiIkE43mIT9GBEuqNmxjDUn0xpn X-Received: by 2002:a17:906:f8d0:: with SMTP id lh16mr1977535ejb.367.1634764241497; Wed, 20 Oct 2021 14:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634764241; cv=none; d=google.com; s=arc-20160816; b=sg5Wmdeo0uhCm6V1s0mjgAX21SGxRnYj4pK22q6PBCDTnRfrdJXxrowsYoC7hxiJFX sIAD79BOl0R5ufLga5JY2+Ua4+whShJjzIbqnZJnoXrGWAgBz8IDSPqtNRpR7/J9yvjg 5uLJk2FZVi7GA2k2oKYVv0UdeGQhmHBZylOq5q5bNhXHGvioQxBcI3a4M8L2GFSEh2UD fGckD+FSCUxDmEAGUFSX9Z1Ch9ntnwlR/Dq0zjDP17+y3RrZ3FqBIP+6nDLbyxqf2vH9 aPc5xMVUJk+7nOgTSoICU6cHgIWvbkNoMfWl08VDoeLXTW0iD+5o9iP9RuilwEPxts1L lrrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YY4rRYrBdBk9JxylDDW+2MAnqVHDh/g91wQSCjGEN3A=; b=NakwyGDBme8QA3/8Kiri3qgxZ7ioD9e35PGQ2t2BLg3P4PCC6BNlF5AhgDJfE8a/Ss Qd9obLP01rIg+KifSRFgtshq2hv83CdZDtH4skgIY1fhDnofEA6XBLSse88nWWPs3cDg X5AZ5KCvfrXRHmgMCV0p28DgUDs+050JTd5sNgDAENIj1vP7faEk2cGjn7Sz7A2EUJVy 2GS0TZZxS1KeF/PHd/Rp7G1UVFWiZFPZRUX46VlBuTngw3EAPk2vYzG3gf5ac65ZlR6H dFEfXJB6NsD3T0GloUSUWg7bSmGQDTyF/91u/h/nvCde7jm181AZAiBNHDQvHGb17RQv BpjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="OSTKM/8E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f18si5374629edd.138.2021.10.20.14.10.13; Wed, 20 Oct 2021 14:10:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="OSTKM/8E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231330AbhJTVKS (ORCPT + 99 others); Wed, 20 Oct 2021 17:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231298AbhJTVKQ (ORCPT ); Wed, 20 Oct 2021 17:10:16 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CEC9C06161C; Wed, 20 Oct 2021 14:08:01 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id i1so415448plr.13; Wed, 20 Oct 2021 14:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YY4rRYrBdBk9JxylDDW+2MAnqVHDh/g91wQSCjGEN3A=; b=OSTKM/8ENI2Vrjms0RwHS0lb7YTvIGp+fuXdcepf9PwoX/X6lDtdcI/3u0xImDro9C M/FuWwpv+d8D++3ZxWN54YWrm5HkuekFOPbCpTkzCO0fdK4r0tOQu1o0B6jY+kst6py8 TNllZEKCAMZJGjuZGVFlKO4sjib/D6/nHxqmBKrP6EvjTHtLlGQo48HfEHus+YJlUU86 6cfADR4HQJG2MTmgShTiJTkzu7NWm4+2xQk+L35yHcGcBwzMQQD/ad5txGLzIqiHedQx +FTgaFLNh1hh2X/lMWy2t0OtGt5RTMuFkPaig9W9DDhYW2muKMH8Osr2pF5CB1p3+3Ni w8dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YY4rRYrBdBk9JxylDDW+2MAnqVHDh/g91wQSCjGEN3A=; b=c6PKMHf3UUTPkR6zhVr05CmoWLgYvdlgij4x3oMHM2xWTpJgzcS+pDhjsz/RBfdWpj Om5H7dbpVf48TaKwz8IlgfsWQ8DDlk9W0AiMopRCR5Fxquu3hfdZp20ZvfbXOr9R4SEh imK23acoRyXhbwpr7Fh9PWUYMA29awZo+yrxqJFg+J8Z5QnWjJELTRdgq7thxlNVU49C 31GHvHN8nt2ffXZbr6fIuS3AlAl1PjRoyf15MakNKTg5RBCcJ10LPzwWsj8iHBAR5LLd kKJ6CR2IFAycGy48vZlXN6rUu8BEHFROInjTxOL4Qa228yEavU3OLX+Czoy87iBfqzYq +81g== X-Gm-Message-State: AOAM5300qag88AeISGL42dz5rKrV6Fr/Xsp5gKqgT/+OE4UgjAS8yU2n vLUo3FagOkGahFkTSyDzwnc= X-Received: by 2002:a17:90a:df8f:: with SMTP id p15mr1087750pjv.209.1634764081184; Wed, 20 Oct 2021 14:08:01 -0700 (PDT) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id i8sm3403143pfo.117.2021.10.20.14.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 14:08:00 -0700 (PDT) From: Yang Shi To: naoya.horiguchi@nec.com, hughd@google.com, kirill.shutemov@linux.intel.com, willy@infradead.org, peterx@redhat.com, osalvador@suse.de, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v5 PATCH 1/6] mm: hwpoison: remove the unnecessary THP check Date: Wed, 20 Oct 2021 14:07:50 -0700 Message-Id: <20211020210755.23964-2-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211020210755.23964-1-shy828301@gmail.com> References: <20211020210755.23964-1-shy828301@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When handling THP hwpoison checked if the THP is in allocation or free stage since hwpoison may mistreat it as hugetlb page. After commit 415c64c1453a ("mm/memory-failure: split thp earlier in memory error handling") the problem has been fixed, so this check is no longer needed. Remove it. The side effect of the removal is hwpoison may report unsplit THP instead of unknown error for shmem THP. It seems not like a big deal. The following patch depends on this, which fixes shmem THP with hwpoisoned subpage(s) are mapped PMD wrongly. So this patch needs to be backported to -stable as well. Cc: Acked-by: Naoya Horiguchi Suggested-by: Naoya Horiguchi Signed-off-by: Yang Shi --- mm/memory-failure.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 3e6449f2102a..73f68699e7ab 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1147,20 +1147,6 @@ static int __get_hwpoison_page(struct page *page) if (!HWPoisonHandlable(head)) return -EBUSY; - if (PageTransHuge(head)) { - /* - * Non anonymous thp exists only in allocation/free time. We - * can't handle such a case correctly, so let's give it up. - * This should be better than triggering BUG_ON when kernel - * tries to touch the "partially handled" page. - */ - if (!PageAnon(head)) { - pr_err("Memory failure: %#lx: non anonymous thp\n", - page_to_pfn(page)); - return 0; - } - } - if (get_page_unless_zero(head)) { if (head == compound_head(page)) return 1; -- 2.26.2