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 DA812C433EF for ; Wed, 13 Oct 2021 02:48:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7263360F3A for ; Wed, 13 Oct 2021 02:48:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7263360F3A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B0D9F6B006C; Tue, 12 Oct 2021 22:48:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ABC8D6B0071; Tue, 12 Oct 2021 22:48:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AA966B0072; Tue, 12 Oct 2021 22:48:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 8E4EF6B006C for ; Tue, 12 Oct 2021 22:48:53 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4AAA730C79 for ; Wed, 13 Oct 2021 02:48:53 +0000 (UTC) X-FDA: 78689881746.26.B929AF3 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) by imf24.hostedemail.com (Postfix) with ESMTP id 70383B0000A2 for ; Wed, 13 Oct 2021 02:48:52 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id i20so3769150edj.10 for ; Tue, 12 Oct 2021 19:48:52 -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=FcS6xVj5q6wKUVENY286UOg4RoQCQeaE3ZNBPYhryVXFwPk61wz0ZDzEHxZzz+N1Vc 7SdBfAf5jHssLMwQ9SOyIUIN9miymEeRpmnEXwS3tV/RSPwhIErpwJxl7TaN34Y4buQ/ n9ZI7rTm6U+c0df/T8Jd2rCdQOnH52MXWxfEwnSa63AreB5oocBpPyu5LQeb9KOQG2jH /6lLHkn61OFPMgz6jwwe4mw6SZbVE3hxIVsz6xbVH/WnT6r8YjjrJJLjuhA2pfdtogzw 3HP+Vg+GwliRY5FFRzBDcmfxD4hhr7/diveAnAwQA+zp8Wy6UhliYJLpMfOiUx45S7e3 upGg== X-Gm-Message-State: AOAM532tYuNgr4aCB37zSX/DMZMGKi2jCPDw2t18BM02v1IW9xoFQwzS 6Ci9OeHbM6IDB+Jjn0bpeJ47U3Eg3tXpYbCNCbM= X-Google-Smtp-Source: ABdhPJx0ADpL3IeCPgiQs+btp6hskCDISm/c40aR79xLjBbigm8sdFG+AmdFBaN76EVqmlE6VUa2c///RnYPJ92xsEs= 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" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 70383B0000A2 X-Stat-Signature: 8njwn1e4ui1xnmacwzcoqax94q67dnjt Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Yd7IDzDB; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of shy828301@gmail.com designates 209.85.208.43 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-HE-Tag: 1634093332-590091 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 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 >