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 A5CF4C433FE for ; Wed, 13 Oct 2021 23:13:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 859A261029 for ; Wed, 13 Oct 2021 23:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbhJMXPf (ORCPT ); Wed, 13 Oct 2021 19:15:35 -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-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 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