Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3040541pxb; Tue, 12 Oct 2021 19:50:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5GNeoE+HUaWHAX7+e7VpHRyfPs0aBvrFa4TKsveeNzQG1qcZi3n+W5RvxGRmvvRoXKS3W X-Received: by 2002:a63:788d:: with SMTP id t135mr15423602pgc.126.1634093415516; Tue, 12 Oct 2021 19:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634093415; cv=none; d=google.com; s=arc-20160816; b=GulCfKIGjF5Ww8EZjizJQt9ro7t9rzXToXlFL8sv0d9moxNKPkhIijPYEs/cBYV8db uSEKwf9uU92Nk9WNzF+DQCWyLDuvxO1jJhV7DDIP3/DjFwJ6UXRkAMbnmhJBijq4qIOm sBVPWE5GYgM0HnzKR1QDmLp8JfcLlfhsAtYFSvu0yoEYV3wnbl2yK8hAkhEb0pFDEoKE 3hYb/vRk4WqZYLvauqM1iQj7JWYs1ZbqzOjllJDUhcFbZk7RG0zS2Q5RjC8ggEGmjkNz +AHYEcV0EYo+TdPuxi/OUrkHcJ6WXVRfvMJ78Q3OkaWLoNip+c1hjvcqe2AUyku1YlYP S0Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JUR/mGvYPsKPEVw6jC+FILMezuz/OqDM8KSj68qp0LY=; b=LWTnIjASGs7CLk4ASmqUlEzEos8tV/P5yXCXVe5X1gDIKqhEaIgZ0Axzaco1TnMt7W RoJY3oScaihJYq6OP6f0/ZUzNH8+iQQJr49eecAj4qHl2+y3rW+1DPTTXqibr/1SJ1mX p62UpEges2quoYA3wEHtErQJ8iYBVUeQecOybQvhRLHpec4hIarQRqIt1xQAvwER2boE /lGbpszfUrZffteZ1UMu7lMECyVNbqVzG4QCiJc9fcwGpSlJkSktFX4vhg1NGuxsmgGC VCv32b/uqwLJWbpfosMqoJxV16oHS+sfdR76AOQypAtZCSo6a6txPejg5ibTEWkGqUPK uhsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Yd7IDzDB; 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 h33si5581952pjd.123.2021.10.12.19.50.03; Tue, 12 Oct 2021 19:50:15 -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=Yd7IDzDB; 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 S236803AbhJMCu5 (ORCPT + 99 others); Tue, 12 Oct 2021 22:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233544AbhJMCuz (ORCPT ); Tue, 12 Oct 2021 22:50:55 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BCEC061570; Tue, 12 Oct 2021 19:48:53 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id g8so3842800edt.7; Tue, 12 Oct 2021 19:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JUR/mGvYPsKPEVw6jC+FILMezuz/OqDM8KSj68qp0LY=; b=Yd7IDzDBhs1jYzqUmRgWTj0v0Cnn8J7FLaaZ2l6VmBUNzCK8QG1NW4v9hK40WDpe00 saC8+xJ1jSYUK5r0CY4FFwbvodFXwfYR8/Bms20ZkJDcmI3gwQNyvsuxqWQxQoSfIF8K BdI6g/y1ttyMHQWTL+xpRnrTeR26bZF116KpKf1vFwYvDSS0dWcOr111q34shL817go/ beFOxa0TXvsVHQqecyLXW1ZTUNRlhDj52ZYeyvwLyzHW8ATTtOlhZ4DX0S+HNmVjXm9V OtzZ2rnbqSoGm+qffj80VdSlCvIOMOP6l3+53d4c/gDekgXWfLTUS9uHjGyUNxa2ylO1 8DOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JUR/mGvYPsKPEVw6jC+FILMezuz/OqDM8KSj68qp0LY=; b=uEVZtY7ivV1hLv87MdrKAQBl4hhh/lIuUrv/pagwa7gvYx565jw8r0vyDd+OaaEbnN n0JiG1FuxjBNrneeNVBHNCbPc8oU+JU2ZyHuwbkJuXI4URA+LGl4guJ2DDJlB1hPlfPW bQiDBO0Xgw3RbdgiLQLsar4gBBnu7ObBK2Mrvz1c5MApTY9SWXfObQzeMUgssOhadEf6 eE4wyJYr54DJbkviCn/kcIVHQklzeO/3DDCLG7cWaH2tWFZpW/LU1zDoyf+ariCI4mmc 6n8Q5zf+z16ebqqXT0Vn/ILL3j1ihDqfqRWl44WFGrDU702wgmw/5J4jN2P18t6/3GUm h2Hg== X-Gm-Message-State: AOAM531hBvLeWHWcvESnx7d74Mt7V7FazUa0k3AWMq/nM+LVvw3wUMkt iqANBZayJHbKVLNK8uJUivs8YrJmgYpDdxgUa4TIpQgU X-Received: by 2002:a05:6402:16d2:: with SMTP id r18mr5591511edx.363.1634093331672; Tue, 12 Oct 2021 19:48:51 -0700 (PDT) MIME-Version: 1.0 References: <20210930215311.240774-1-shy828301@gmail.com> <20210930215311.240774-3-shy828301@gmail.com> In-Reply-To: From: Yang Shi Date: Tue, 12 Oct 2021 19:48:39 -0700 Message-ID: Subject: Re: [v3 PATCH 2/5] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault To: Peter Xu Cc: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Hugh Dickins , "Kirill A. Shutemov" , Matthew Wilcox , Oscar Salvador , Andrew Morton , Linux MM , Linux FS-devel Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 12, 2021 at 3:10 PM Peter Xu wrote: > > 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? Yeah, you are right. I noticed this too, only successfully migrated page is marked as hwpoison. But TBH I'm not sure why it does this way. Naoya may know. Anyway, THP doesn't get migrated if it can't be split, so PageHasHWPoisoned doesn't apply, right? > > 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. That compound_head() call seems to be for hugetlb since isolating hugetlb needs to pass in the head page IIUC. For the pagelist, I think it is just because migrate_pages() requires a list as the second parameter. > > -- > Peter Xu >