Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3925288pxb; Wed, 13 Oct 2021 16:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZvcpLyDJot2W2Z3FP4vMrENfntr8rQese8kOW7oW2fonqSvcXfu0qeCJXErjTJvHFVbIY X-Received: by 2002:a17:90a:858e:: with SMTP id m14mr16730278pjn.1.1634166983301; Wed, 13 Oct 2021 16:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634166983; cv=none; d=google.com; s=arc-20160816; b=j4ACsaSBCRCKLmTLhCylRvipJtyjG5wVDXIQd6hC2eZm91ryDf8gOpLcS6eOcyfVX0 wb5Te17cYA9DpiyDEdUm1B+4iaH9bjwwlfOlpfc0Z1f58IuAmCPftF9yi17cD4381tGf RnFD6W3Samf2Ry0PdufYNZI6B2d80idIjg73UEzFZFbCrEY/IAZkq9/+BeWbXyoLRHeP zDl+pmnZMw1mxp49WO73WGsrnUrO0G3s8j9JgSwVZVWQf/U4mZnlqbnzlWn7g1f0nuyz 0Cx1UsvF9W2h8gLMVFacvjtp8XVKlOb2xuks8thYvYjLB+8E6VtkLB0/rk/DAzySxKki Ctfw== 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:date:dkim-signature; bh=vHKHqM6joTjLTO+LAIK0a1VhLnO657jhFhkTCdfnQy4=; b=eOGjbKmMT0uZe5S3Mm84p/D5IN6f+LauGgEgG8YvqxZRHgx8oJBxILczQhouCyTu/1 nMWkfAMAU1/qt+T9/tdgc2chEfthHHym0K6LBYcdQk7xtvOeChxQUocLJf4Y1CSAgfXM AfLtEaA2XrA+3xLGAOhPwwjKx3iuBzQNeFAWZlpnWRGf6VD5gOn4GjTUcTCxPcBlNZI6 dTeBHrfezhyEpxjXGEU85L2XyZ6mqTKJrCjBW84NhAWenmlWMm7SRBeBnFKDdPlFNARA jiBqr/gKNoh9J6cFLgeF5x8+/2E0+21jRWtYFLJmmjYAVZ/F4KT3P7mPVtO6GVo2UCP7 G5pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dDyCpTDo; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e25si1243344pgv.612.2021.10.13.16.16.11; Wed, 13 Oct 2021 16:16:23 -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=@redhat.com header.s=mimecast20190719 header.b=dDyCpTDo; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbhJMXPe (ORCPT + 99 others); Wed, 13 Oct 2021 19:15:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47054 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbhJMXPd (ORCPT ); Wed, 13 Oct 2021 19:15:33 -0400 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-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-rOs0gM8iOse86LQy1VQv-w-1; Wed, 13 Oct 2021 19:13:27 -0400 X-MC-Unique: rOs0gM8iOse86LQy1VQv-w-1 Received: by mail-pg1-f198.google.com with SMTP id n9-20020a63f809000000b0026930ed1b24so2294064pgh.23 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=wHP5UmeVMj+KaZ1g/KiyfkJ3DOytREgLiZVb/IZX9AA1I4v6gnjTmcUQQdS9RkwOD9 xIw/kdY/xPjlhJ+R+T167GQLe9BLElTB/+meTB/EXCSSX/ZazbSKIB80FFYfYaggh/WC IXva3c4EsYl52dUAYUIITncWhjS6Z+/GUvbaZuEkCd48NwsgyfxgQWBZYnwcGDIJGZJO fohaHdx2wOuFCq2GapTfiLr+cgRPxcWxSrLU0SEs7C8ZI5MECjFClVxKQxkfDIFB6oh1 YUg7L8N9dU+6dneNXCweI4qvLVXrH9G0v8J1hSHn1DeBOQWFanZ6EJlp2vIfCsZ1WHmA 3q3Q== X-Gm-Message-State: AOAM531mjgiGNH/BREG4++RB33EmL1yCsCPUyQ5TFtgszbk2zexYC4sS 4Oe8XC26RbRRz0Zmep9cChDXgiaryPFGoJ/d8uSQDgDZLXfayvecscl6aoxtFOm3QhbzJzzPGVg VWhizbxzSvDdZ4a25dWYKrz53 X-Received: by 2002:a05:6a00:ac6:b029:374:a33b:a74 with SMTP id c6-20020a056a000ac6b0290374a33b0a74mr2157866pfl.51.1634166806289; Wed, 13 Oct 2021 16:13:26 -0700 (PDT) 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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