On Wed, Oct 13, 2021 at 11:01:33AM +0800, Peter Xu wrote: > On Tue, Oct 12, 2021 at 07:48:39PM -0700, Yang Shi wrote: > > On Tue, Oct 12, 2021 at 3:10 PM Peter Xu <peterx@xxxxxxxxxx> 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 <peterx@xxxxxxxxxx> 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. > > My wild guess is that unlike memory failures, soft offline is best-effort. Say, > the data on the page is still consistent, so even if offline failed for some > reason we shouldn't stop the program from execution. That's not true for > memory failures via MCEs, afaict, as the execution could read/write wrong data > and that'll be a serious mistake, so we set hwpoison 1st there first before > doing anything else, making sure "this page is broken" message delivered and > user app won't run with risk. > > But yeah it'll be great if Naoya could help confirm that. Yes, these descriptions are totally correct, how PG_hwpoison flag is set is different between hwpoison/soft-offline mechanisms from the beginning. Thanks, Naoya Horiguchi