From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A7F3C433EF for ; Tue, 12 Oct 2021 00:55:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AABC660F14 for ; Tue, 12 Oct 2021 00:55:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AABC660F14 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 1AF3B900002; Mon, 11 Oct 2021 20:55:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1382A6B0071; Mon, 11 Oct 2021 20:55:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF412900002; Mon, 11 Oct 2021 20:55:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id D938E6B006C for ; Mon, 11 Oct 2021 20:55:40 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 815012CBC8 for ; Tue, 12 Oct 2021 00:55:40 +0000 (UTC) X-FDA: 78685967640.17.7D8AE35 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 229E33000789 for ; Tue, 12 Oct 2021 00:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634000139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5XDAu3SGcluw99zx826t100OV6JMSzpG+T+53hkiL5g=; b=SkBiFKHvCwpg9QFD01wvPoD4zoal4VyunbM1MH0igztFiyk0zNRXb8F9V8LN6LCV3tUlhP dbgGBGUd2RSKHSma46JMrzmqjrGbOvTsy+LVxjo+A2u1HsJ09/cmFI0g2iLHSCW8BISwr0 sUQMKWzsqFq2qrV6P6E0OsevpbHTGUs= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-388-alwYX80iP5W1_s4HNWe9og-1; Mon, 11 Oct 2021 20:55:36 -0400 X-MC-Unique: alwYX80iP5W1_s4HNWe9og-1 Received: by mail-pj1-f69.google.com with SMTP id b17-20020a17090a551100b001a03bb6c4f1so571880pji.5 for ; Mon, 11 Oct 2021 17:55:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5XDAu3SGcluw99zx826t100OV6JMSzpG+T+53hkiL5g=; b=mHyovu/LQZ3Zlh4JiLHKKVc0/EsYGSZIVdXgY6KtcXFTcZ11Hr0ezMNVv/1CRqxMLX BKSkIgnPTSiE4PbBmLJXR9uRkycSb2BxgG/Unc5pokIo4SKB/ZRNoWum9I5Phl6Dqb2p B0Vs1ExeK87n36aydwoYzSan610JEJTOoOG4Oh10tfRgOPrFsxIQnWTYyVKc0Ls+j+nm Hk36JicJ9HIM/fFTsvoDby+/S+6sM+Xpsx3b62hcHSSZnlt9KI67HGhlSN6F+ou0Bj1x wtSv/lggFJRcPJM30zB1P2qsuy961fbXR4jiSM2+/jWhyAtqF3bBXQAjbWZzxzqHBtPR tdwQ== X-Gm-Message-State: AOAM532O7Hp6JZaeUer8EtqomfqLxwsuwWMLToUrQzeCHLftmt8hfcth 1sDmrn1j1XfVYzEInoYOLT0HlqQbf9p3TLPE3h7XT20pZfb/kykLBPtDaZ8bBkBB4zVkoilMeeW o9X9UMtc8Npo= X-Received: by 2002:a17:90a:5583:: with SMTP id c3mr2475851pji.133.1634000135079; Mon, 11 Oct 2021 17:55:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiMrYc31WKAIet63PwjB3iBU25JIVgyGtttIqJYbNFV+SGkFsxX1I3SP8DPzgGL+Ed6sKQAA== X-Received: by 2002:a17:90a:5583:: with SMTP id c3mr2475808pji.133.1634000134583; Mon, 11 Oct 2021 17:55:34 -0700 (PDT) Received: from t490s ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id z9sm578759pji.42.2021.10.11.17.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 17:55:33 -0700 (PDT) Date: Mon, 11 Oct 2021 20:55:26 -0400 From: Peter Xu To: Yang Shi Cc: HORIGUCHI =?utf-8?B?TkFPWUEo5aCA5Y+jIOebtOS5nyk=?= , Hugh Dickins , "Kirill A. Shutemov" , Matthew Wilcox , Oscar Salvador , Andrew Morton , Linux MM , Linux FS-devel Mailing List , Linux Kernel Mailing List Subject: Re: [v3 PATCH 2/5] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault Message-ID: References: <20210930215311.240774-1-shy828301@gmail.com> <20210930215311.240774-3-shy828301@gmail.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 229E33000789 X-Stat-Signature: 9eoazp4dkzjaegcatcy8c6fyt4g7scm6 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SkBiFKHv; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf03.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-HE-Tag: 1634000139-219343 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: On Thu, Oct 07, 2021 at 02:28:35PM -0700, Yang Shi wrote: > On Wed, Oct 6, 2021 at 4:57 PM Yang Shi wrote: > > > > On Wed, Oct 6, 2021 at 1:15 PM Peter Xu wrote: > > > > > > On Thu, Sep 30, 2021 at 02:53:08PM -0700, Yang Shi wrote: > > > > @@ -1148,8 +1148,12 @@ static int __get_hwpoison_page(struct page *page) > > > > return -EBUSY; > > > > > > > > if (get_page_unless_zero(head)) { > > > > - if (head == compound_head(page)) > > > > + if (head == compound_head(page)) { > > > > + if (PageTransHuge(head)) > > > > + SetPageHasHWPoisoned(head); > > > > + > > > > return 1; > > > > + } > > > > > > > > pr_info("Memory failure: %#lx cannot catch tail\n", > > > > page_to_pfn(page)); > > > > > > Sorry for the late comments. > > > > > > I'm wondering whether it's ideal to set this bit here, as get_hwpoison_page() > > > sounds like a pure helper to get a refcount out of a sane hwpoisoned page. I'm > > > afraid there can be side effect that we set this without being noticed, so I'm > > > also wondering we should keep it in memory_failure(). > > > > > > Quotting comments for get_hwpoison_page(): > > > > > > * get_hwpoison_page() takes a page refcount of an error page to handle memory > > > * error on it, after checking that the error page is in a well-defined state > > > * (defined as a page-type we can successfully handle the memor error on it, > > > * such as LRU page and hugetlb page). > > > > > > For example, I see that both unpoison_memory() and soft_offline_page() will > > > call it too, does it mean that we'll also set the bits e.g. even when we want > > > to inject an unpoison event too? > > > > unpoison_memory() should be not a problem since it will just bail out > > once THP is met as the comment says: > > > > /* > > * unpoison_memory() can encounter thp only when the thp is being > > * worked by memory_failure() and the page lock is not held yet. > > * In such case, we yield to memory_failure() and make unpoison fail. > > */ > > > > > > And I think we should set the flag for soft offline too, right? The > > soft offline does set the hwpoison flag for the corrupted sub page and > > doesn't split file THP, so it should be captured by page fault as > > well. And yes for poison injection. > > Err... I must be blind. The soft offline does *NOT* set hwpoison flag > for any page. So your comment does stand. The flag should be set > outside get_hwpoison_page(). I saw that page_handle_poison() sets it, so perhaps we do need to take care of soft offline? Though I still think the extra bit should be set outside of the get_hwpoison_page() function. Another thing is I noticed soft_offline_in_use_page() will still ignore file backed split. I'm not sure whether it means we'd better also handle that case as well, so shmem thp can be split there too? -- Peter Xu