Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4198413pxb; Wed, 13 Oct 2021 23:57:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS0BJuQ5Y9092dfrL95v54mq52nql9hTrlMINelGYTNCThfxyiW8jemFjhIJmhZ2Y/jZfr X-Received: by 2002:a17:902:f683:b0:13f:a79:52de with SMTP id l3-20020a170902f68300b0013f0a7952demr3497417plg.43.1634194668776; Wed, 13 Oct 2021 23:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634194668; cv=none; d=google.com; s=arc-20160816; b=IZlmvp69atqfi208sax1ZZGY8qvPgqnRtnMSaEHw9SvZzgVDG4ELd+3Km8cZm7qr6S iuwy3xG/W/btmznS36apcrMzo4aEqLmbCir4ejrwD71IP/dsNGNQ2B/baROEFcFDQBfE r0rYRXkvTvSoRx7FfxNFWJRzN4Zr6aPlIifIgXtig8aupYK5lUfiWcJe6uZeFtMvIVXP uCbNZCE8bxuWixIRWNiNToSrfyCYIjtgFsCjEpvhPLE6R0k0SEu7rPeBxbnJCpRRzNVd fVMPa0T6VkMJfYK4kb2tLETAa3Q8N+3nfQ3FB/Pg0z+qGXZgDPZs3+xpNqGKSFzLS6ZY 1wDw== 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:dkim-signature:date; bh=N/aD5fWtoSotnmi+BFKZ86QWaol2dougMlY39ccGabg=; b=h/4FFHznMmehg3c6aAtfxkNZUKXLSNtwLcaI0F9ORyapNWAHOypBiVnrA2/Oh7XcvG gKlg+R3znxUXzYAfxAicbDZ/nc1PFiwWQlsxevwf2JE8EQ3iNhfXAtoPqcna48uRT4i8 wKwbP3WMbc3e8bkjxuH4Ah+TDBDmaVvT4s/F6CTPzoyTQJHTFRztuz465i+3/wYX0muD T9bRnDylu796ME8hsLDHy99Bfc5BhSsdAfyLc19kHEx8TKMAltppcocCaZT+gW2iguO1 zwvr7aKnSoLQoUDdaDhn88uiOd9j5TCMROtQ9ADGo/elpF8q3GR39sz7+gT77Ja5Xh0S GoBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=HRDs9CMb; 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=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 19si2596801pjd.6.2021.10.13.23.57.30; Wed, 13 Oct 2021 23:57:48 -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=@linux.dev header.s=key1 header.b=HRDs9CMb; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229746AbhJNG4o (ORCPT + 99 others); Thu, 14 Oct 2021 02:56:44 -0400 Received: from out2.migadu.com ([188.165.223.204]:52962 "EHLO out2.migadu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbhJNG4o (ORCPT ); Thu, 14 Oct 2021 02:56:44 -0400 Date: Thu, 14 Oct 2021 15:54:32 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1634194478; 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=N/aD5fWtoSotnmi+BFKZ86QWaol2dougMlY39ccGabg=; b=HRDs9CMbOaq5Jz299llyEDwwLkvDBBltsjUdXbjpqAfB13u56yrVQq2rx15S0W8fZ2bsFM BFuf8ueb0kdZNa1VIVOWCYefpxNDVyAGUbhMmPXwK+XzeTt5DqhCXFbbTHurRt4Z8Zu33v T8Z4oeCCl4NOzOUEzsrS8lvN2bYtztU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Naoya Horiguchi To: Peter Xu Cc: Yang Shi , 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: <20211014065432.GB2017714@u2004> References: <20210930215311.240774-3-shy828301@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: naoya.horiguchi@linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. > > 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