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 C2FE8C433FE for ; Tue, 12 Oct 2021 22:10:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 470CE6109E for ; Tue, 12 Oct 2021 22:10:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 470CE6109E 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 BC894900002; Tue, 12 Oct 2021 18:10:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B77E66B0071; Tue, 12 Oct 2021 18:10:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1874900002; Tue, 12 Oct 2021 18:10:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id 8E4036B006C for ; Tue, 12 Oct 2021 18:10:16 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3E174182646E6 for ; Tue, 12 Oct 2021 22:10:16 +0000 (UTC) X-FDA: 78689179632.01.B73F44E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf03.hostedemail.com (Postfix) with ESMTP id B256830000AC for ; Tue, 12 Oct 2021 22:10:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634076615; 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=FhnQJOVp52xhvtPJuNN5IN/xXnigXzLNCriTIkjdjeZs+mF7ZmHqlRuBjTEHOeIcgVSOIx G8P2H51VRdv0lwhs77Z7dFhXb4aAKYvKejkptnvEBpCvGiuHFo4WUE/69r9JhpwSc/w70c A5g+c0VI/N2Ufc4pILRGWkMDrJWJw0c= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-V7WliA2zNha8BIOlxw5Udg-1; Tue, 12 Oct 2021 18:10:13 -0400 X-MC-Unique: V7WliA2zNha8BIOlxw5Udg-1 Received: by mail-pj1-f72.google.com with SMTP id l10-20020a17090ac58a00b001a04b92a5d4so459347pjt.8 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=dRunoekLwrHDOrElTE9PSox9sFkjw3iBLU/9X8u2qnJLnKdLhorb7uiCwtuCnJi4WJ N0hJ9Z7rdYvI58CwTFGEcoyNZbB/YTo8XoDyYogsgYFe/d+UMJNTw0bCJbM5qCSFR19d tlKLLyp/Xlg5BC5JLJ/NBVXG8BSws9505WFDFbHVKhyZbNSN88FYuXZa4Jt6KQpVsTYI pNWo04vYb1L60otJl0740hZZSLpID3B0K5sZtJ9cxAepypwXLDvUCiJTr1qskG2uHXLB tZbla3CbKfsJuHlXe9H6WzUluEeaGHY1jv2Bao48fMSqkqFSj8Ll3G5dYBO55CervVk/ lWZg== X-Gm-Message-State: AOAM531tKrEFRmsO5WduAaPZOkjnvlSfL+S0w0aXJxtDNReEeb2a9O6E 65YXgSHUuOXaPN4vR19Os+7qdd41YDjX1wpizqFEKuB68tNm3Ur5N7b7+h+DqtvJVazlKeUqt8T jI1kwQfCkEe0= X-Received: by 2002:aa7:8294:0:b0:44c:c0b:d94c with SMTP id s20-20020aa78294000000b0044c0c0bd94cmr34036398pfm.24.1634076612541; Tue, 12 Oct 2021 15:10:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVcl7YM/k3v8LTKkEj6FzmcyKS70hDecSUEZ9AzemVvzccMcT6kL62psxDZo6c4AlO7y5zwg== 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 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=FhnQJOVp; spf=none (imf03.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B256830000AC X-Stat-Signature: 5u33nkbwaa9eq639gtjwi8a8hgmu6y1p X-HE-Tag: 1634076615-222734 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 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