Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2861085pxb; Tue, 12 Oct 2021 15:12:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/KhTh2nPtFjtgLB0dnVPAAe/YmX9a5eXLuTEwyRNPJZ2enM32F+dhJLRT3bs/42I1tode X-Received: by 2002:a17:907:8a12:: with SMTP id sc18mr33513100ejc.569.1634076766827; Tue, 12 Oct 2021 15:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634076766; cv=none; d=google.com; s=arc-20160816; b=0WNw4ySW0PZD2JKxBSfQN6XLnXYRApRD116R7hqSh2rRn+d+QbxYPOJQI/V7OqQVNL MqTX/1E1dxCKsPGwpv0NfAcaH0TFO8G06k9nv6xCJDmW5308YtJpCLtG8gEi/TKy6h+v Oc+CFi80j2WgZH58F3WycwB1rBtlaRFAJ4pLiTdsuH9+Y4U/1CvFqBg3v0PHZ/9RkqWT VgwcgrMM6sufKczxPFf0M4sCR+hnulGxCLbsc0HLS89uiymTV62/ya35HWwCkjR5n20H euxQCOzCpin5hp7QMYkwnfP4xnaLHOIGdrabzLJefZ53XPCZWlCKyKzS+Xpfk5uibybs 5YZA== 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=Ua5oJG0CdYheQ7ierae4aE9Z756sdeVCm8xh3uzk1vo=; b=X0q+m7XvCOUy5xY0UGaDe0LZzEaix9+U9F9F9hR8878ixg0gzuAiyZgV05ip9cUxm2 D2tcNPC32Vc1i4qHY3XxpO6E+r46/ogEEfGbRK1r3xcSMORbd4HbYEP9BU72pdMcRGkp bfTbI+zvJBr0YVkfr75xdBcUI6jfiUKpoQkdOeTZECYrLbSoTBg9A5jl3OkF8Gk8Fw24 TdflDMnrkuQqm5uOsVfILgzJEEM8KBf7TwhekuxNhvOQYkpi73MFkNdiSYsvhb7Q+f4I SZGPDuLzD3tIlKgsnwByCSRVw0LWnhvE5vR8of2WsWhYo6xJgWLISIOnvOjQKrO4QQJP Mwew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GPUpMRrO; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si18184078edb.316.2021.10.12.15.12.23; Tue, 12 Oct 2021 15:12:46 -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=@redhat.com header.s=mimecast20190719 header.b=GPUpMRrO; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235747AbhJLWMS (ORCPT + 99 others); Tue, 12 Oct 2021 18:12:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33866 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbhJLWMR (ORCPT ); Tue, 12 Oct 2021 18:12:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634076614; 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=Ua5oJG0CdYheQ7ierae4aE9Z756sdeVCm8xh3uzk1vo=; b=GPUpMRrOQo6VVie6L2crtdV6WIyYG/iefwRiFauhRJLjWsEOSzkxhOgbK03A1WXmSkrDb4 TcXCc+5Mr8fjNkQtIppvRh48NEN556bNS+btbJY8KrZs+AhHm4d6pmBSxfrJiNlEaSKrdS vyLz5ywjs4gtv5/S4Wi5hmtqHFYDUJA= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-529-h2QyQMHkNFG5er6eNF498A-1; Tue, 12 Oct 2021 18:10:13 -0400 X-MC-Unique: h2QyQMHkNFG5er6eNF498A-1 Received: by mail-pl1-f199.google.com with SMTP id k1-20020a170902c40100b0013f47bac4d8so135635plk.14 for ; Tue, 12 Oct 2021 15:10:13 -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=Ua5oJG0CdYheQ7ierae4aE9Z756sdeVCm8xh3uzk1vo=; b=caX0o8FD9b0ZqRfX26KFS23cCWdOAt+vIa4GOXaMWg7ikGNR+ekHOFZSvp3q1amkO8 8cbac0JRVIjQstDBQSFDl2ddwBqpFBhNIZoOV5ZznjfezlQM3HRc6VfZT+/frPe6zNbl QyNUBm+L4p7P0KIKppL15N7mPbDiSUXolEYTPZq1OZ5PirsgXOIRXgbcRyBSLtFx2hm1 ebfWsvKvY8+qOs1SxMfaHdE0SIRZO4EMDx+FdxtfJUg4am7uFObIabOi7n4zev8Zy3Jm RXlCfQtvkgF8tYfwfeaKyQCpeTzEckikgcHH4vJvNZpwLSPOI/jduwzdCEmcbLF04huG oFlw== X-Gm-Message-State: AOAM531bmWstO6OXVg0CZNvGL5YuGJKsx7G/p62qe87ufUfHqTGIM7f6 5OLdDjjsEcuXN5iNTADZJ5sWBykmkwtVrY7s0TpNE64R33p2PnoOrdTeH2A9tGygPYfGtkBl24t Eg6fGR8cgmXsgh0lRYum6nMSy X-Received: by 2002:aa7:8294:0:b0:44c:c0b:d94c with SMTP id s20-20020aa78294000000b0044c0c0bd94cmr34036402pfm.24.1634076612542; Tue, 12 Oct 2021 15:10:12 -0700 (PDT) X-Received: by 2002:aa7:8294:0:b0:44c:c0b:d94c with SMTP id s20-20020aa78294000000b0044c0c0bd94cmr34036372pfm.24.1634076612191; Tue, 12 Oct 2021 15:10:12 -0700 (PDT) Received: from t490s ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id z13sm11967179pfq.130.2021.10.12.15.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 15:10:11 -0700 (PDT) Date: Wed, 13 Oct 2021 06:10:02 +0800 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 12, 2021 at 11:02:09AM -0700, Yang Shi wrote: > On Mon, Oct 11, 2021 at 6:44 PM Peter Xu wrote: > > > > On Mon, Oct 11, 2021 at 08:55:26PM -0400, Peter Xu wrote: > > > 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? > > > > Please ignore this paragraph - I somehow read "!PageHuge(page)" as > > "PageAnon(page)"... So I think patch 5 handles soft offline too. > > Yes, exactly. And even though the split is failed (or file THP didn't > get split before patch 5/5), soft offline would just return -EBUSY > instead of calling __soft_offline_page->page_handle_poison(). So > page_handle_poison() should not see THP at all. I see, so I'm trying to summarize myself on what I see now with the new logic.. I think the offline code handles hwpoison differently as it sets PageHWPoison at the end of the process, IOW if anything failed during the offline process the hwpoison bit is not set. That's different from how the memory failure path is handling this, as in that case the hwpoison bit on the subpage is set firstly, e.g. before split thp. I believe that's also why memory failure requires the extra sub-page-hwpoison bit while offline code shouldn't need to: because for soft offline split happens before setting hwpoison so we just won't ever see a "poisoned file thp", while for memory failure it could happen, and the sub-page-hwpoison will be a temp bit anyway only exist for a very short period right after we set hwpoison on the small page but before we split the thp. Am I right above? I feel like __soft_offline_page() still has some code that assumes "thp can be there", e.g. iiuc after your change to allow file thp split, "hpage" will always be the same as "page" then in that function, and isolate_page() does not need to pass in a pagelist pointer too as it'll always be handling a small page anyway. But maybe they're fine to be there for now as they'll just work as before, I think, so just raise it up. -- Peter Xu