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 2B821C433EF for ; Wed, 13 Oct 2021 23:13:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AE66B61029 for ; Wed, 13 Oct 2021 23:13:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AE66B61029 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 470336B006C; Wed, 13 Oct 2021 19:13:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F82C6B0071; Wed, 13 Oct 2021 19:13:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24ABF6B0072; Wed, 13 Oct 2021 19:13:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 1162C6B006C for ; Wed, 13 Oct 2021 19:13:30 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id AC36C18039528 for ; Wed, 13 Oct 2021 23:13:29 +0000 (UTC) X-FDA: 78692967738.24.A1BD1A4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 4743790000A2 for ; Wed, 13 Oct 2021 23:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634166808; 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=vHKHqM6joTjLTO+LAIK0a1VhLnO657jhFhkTCdfnQy4=; b=dDyCpTDo6h/3LhFaFxjWIF3jehTC8YmTTsV8mLMm3MmfIQJuujVpJ/Ior1zAaybZa4mYGT XwMN4g5za+DbepyXXFLdiYy5FYLwGeV6CfUnLgb8+hbyKfSoPOLTqxumBLRvT/Xe0AqRbB PtbmgZIAnJGeXKoGKlNWBSr+O4mLvHM= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-TSmBPQXMNpSLFQq4AYP6fg-1; Wed, 13 Oct 2021 19:13:27 -0400 X-MC-Unique: TSmBPQXMNpSLFQq4AYP6fg-1 Received: by mail-pl1-f199.google.com with SMTP id p17-20020a170902ead100b0013f7d398f40so17387pld.18 for ; Wed, 13 Oct 2021 16:13:27 -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=vHKHqM6joTjLTO+LAIK0a1VhLnO657jhFhkTCdfnQy4=; b=gZiQLiVzrysZ7ZATT0m7P4qnHBY+WBcHK0unhGvEliNUJG3Py6dC19wvq6/77fOzTI FAk/uvS+5ZLfpiDEZHDIxuK9H77s6FvjXyJY6VmpKIIrWM5zGrDyJq9PYPLljLxzG/O9 vMhofNquRWBMNRGv0F66F6S50SXDxuPPljELfRHr535ZyAsYONSja+/WvwJ4+fbRRSy+ FoBTFlJkwEuqimVbOuvEy7QeZ3+vN7v8y6E0RcSVXOlO7GhxjVNPayHPVynPtchC8PrW PWsKt3LV/yXg06h3KG8BY0SxpbmI3E/z1ksso4xo8p+YxoDYRnJyiupnrEFhMyzig9Bn +CRg== X-Gm-Message-State: AOAM530CCCNnS8EF74yGHrOuoo4zAuiu9iXSxt46Vg3dgBsFdnx09WjY ulYl2MLNP6r60q9sCQY350VZB6Sd/59VVUO+KTN+WyBlfL1g6A4Hj1a/XqL6PDVAbr6V1/h0f09 oXCS83QftS30= X-Received: by 2002:a05:6a00:ac6:b029:374:a33b:a74 with SMTP id c6-20020a056a000ac6b0290374a33b0a74mr2157870pfl.51.1634166806289; Wed, 13 Oct 2021 16:13:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyosAo3Rd7PHBy+R/128zfAHbsbgJfHLUuFFIbmXdGJzX054smRXN6zXt9Qeh9AnGI+ZzVpBQ== X-Received: by 2002:a05:6a00:ac6:b029:374:a33b:a74 with SMTP id c6-20020a056a000ac6b0290374a33b0a74mr2157843pfl.51.1634166805966; Wed, 13 Oct 2021 16:13:25 -0700 (PDT) Received: from t490s ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id t28sm487986pfq.158.2021.10.13.16.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 16:13:25 -0700 (PDT) Date: Thu, 14 Oct 2021 07:13:18 +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: 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 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 4743790000A2 X-Stat-Signature: nakp91uhmhca5xth8fcmn8it6xp84dnp Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dDyCpTDo; spf=none (imf28.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1634166809-408256 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 Wed, Oct 13, 2021 at 02:42:42PM -0700, Yang Shi wrote: > On Tue, Oct 12, 2021 at 8:41 PM Peter Xu wrote: > > > > On Tue, Oct 12, 2021 at 08:27:06PM -0700, Yang Shi wrote: > > > > But this also reminded me that shouldn't we be with the page lock already > > > > during the process of "setting hwpoison-subpage bit, split thp, clear > > > > hwpoison-subpage bit"? If it's only the small window that needs protection, > > > > while when looking up the shmem pagecache we always need to take the page lock > > > > too, then it seems already safe even without the extra bit? Hmm? > > > > > > I don't quite get your point. Do you mean memory_failure()? If so the > > > answer is no, outside the page lock. And the window may be indefinite > > > since file THP doesn't get split before this series and the split may > > > fail even after this series. > > > > What I meant is that we could extend the page_lock in try_to_split_thp_page() > > to cover setting hwpoison-subpage too (and it of course covers the clearing if > > thp split succeeded, as that's part of the split process). But yeah it's a > > good point that the split may fail, so the extra bit seems still necessary. > > > > Maybe that'll be something worth mentioning in the commit message too? The > > commit message described very well on the overhead of looping over 512 pages, > > however the reader can easily overlook the real reason for needing this bit - > > IMHO it's really for the thp split failure case, as we could also mention that > > if thp split won't fail, page lock should be suffice (imho). We could also > > Not only for THP split failure case. Before this series, shmem THP > does't get split at all. And this commit is supposed to be backported > to the older versions, so saying "page lock is sufficient" is not > precise and confusing. Sure, please feel free to use any wording you prefer as long as the other side of the lock besides the performance impact could be mentioned. Thanks, -- Peter Xu