Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3068816pxb; Tue, 12 Oct 2021 20:44:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8AYs8KwPzg/2/MOHU4p5Lsp2A3DQnxozN9GAvQuTYeudXGbw5j3x/5vkJJXZQZOcEHaJW X-Received: by 2002:a17:902:9b95:b0:13e:c43:2b57 with SMTP id y21-20020a1709029b9500b0013e0c432b57mr34097456plp.42.1634096661155; Tue, 12 Oct 2021 20:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634096661; cv=none; d=google.com; s=arc-20160816; b=pTVicF28zNuw/YW6T1aCqzADsCXT6BYe1sXRTlNuQScDs3AFmCstWDDbDf12Unc+Hh onKqOkhdG7Vsu6hY+vRmCI7RuQwNxFcXI7zZSnK8n3TJvOksnhz4nMccT3DoFqp4CNsp Tr/JUjrqpde7pEPinVgR4J9txVGgtlfjLmGS9TCEodfOJId24nMBE3Gh2rphGeTjJVjf xn8MLN5zWup+y3fF2hvusZVjBJfpibOw9Nik+2HtPPkqy1hIJo+RhYoDh0NoHrtQR+tH AgOkt2cmpbo6j0en89m1CjhHpinm+IqdhBiiwXsjg1pvyW2ZMkMmOvZAa1//jJ6KyHoI ESMQ== 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=P9QQpHMzPqOGAUAgrM92CQtjCHKsEXKEq2E7CGbFGTs=; b=uk39DdqYxRCxoIycckLWpUbThLsNdagCgenyyM6DVFciQrHOEJhl/ZAfItEvNzTBnj scO4goz3CTIyLfsOTPbBvnNLbt1Cj7EhrvI66FAzT++4WX9FB9PknYHIMtSIpa6y9z+V GDcQ/kfzdOSxwvlROioMZlAuHQaE4FRCgAKkqDreYCwu9Ac4nlb9pSMguQ/WWlmJl2H0 pfbGYhNfbOivS8plA1RADWEnmZOOWf6QPPP+p6SsnE2duWspHNGHnrrkdsJPrdrRPIDp 7oJGPR+/ja/OpgevNV0kz3gaHTw53MoxFyVg8komrENRWW3P1Ht/k/ZcLAI7AUCZ2zMz C1Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FCGuTLXq; 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 q3si4481824pfk.104.2021.10.12.20.44.07; Tue, 12 Oct 2021 20:44:21 -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=FCGuTLXq; 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 S237269AbhJMDnz (ORCPT + 99 others); Tue, 12 Oct 2021 23:43:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23266 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231253AbhJMDny (ORCPT ); Tue, 12 Oct 2021 23:43:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634096511; 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=P9QQpHMzPqOGAUAgrM92CQtjCHKsEXKEq2E7CGbFGTs=; b=FCGuTLXqaKbORxt68jvecb+cOY8K6lYUomVBsY6I8aRuTVdXAKYOVV/9hZcWslkth17u8h mwHnlIVuwKrF+bAdDP5E9Zugx4bOpR9c1P6UuA/1VYkyfekeUMozPbgfhzR3ti4/ok/5Vy f3S0sZsWjgaGRGIbtbpJhLWDt0U4CV0= Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-DMxmEFpOPu-jVf1KoTS_DQ-1; Tue, 12 Oct 2021 23:41:50 -0400 X-MC-Unique: DMxmEFpOPu-jVf1KoTS_DQ-1 Received: by mail-pf1-f197.google.com with SMTP id j2-20020a056a00174200b0044d39a43c9bso758593pfc.22 for ; Tue, 12 Oct 2021 20:41:49 -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=P9QQpHMzPqOGAUAgrM92CQtjCHKsEXKEq2E7CGbFGTs=; b=ngwbzhV+J6OJKvYs/gXYeVuk4BNGdw7E2FKa2L8oqBBrkQxgdbcwUpcNpa3830DQae uFgllCvyGxZseu+UYxK+UKyijmpYkFx4Okm/sPBvXOXi4qCiTxbu5U8WWGieTDMRphjR Das9QjJ3PrpPw4zopkr1CdIuCF0ju09KSWzqRzh/A0XYgQo9uvghbuhfKriSh+BBWLyq +h6zS3YRaHAAGfRr+LLXUP5mXnaekLqrF9tuja981liDPFgUeTavjo8QyO/PV4kCn2Hg qc1UcFNbeMdMhvE6ZFDt57Zet4TM5dnHBIg80QcQQS7bXrl2AUJ8M3B/hDZRuYEbiwXn kJ8Q== X-Gm-Message-State: AOAM532p+A4t0d8feX8SLhdwYbTWxAaTEpQ18VHFCMsj44YM9u0Rhw6j UouR6HTBvrEZPfLjU2K4oF9RFx3JUzLUhnGBuYg5dFrJ59P4rs2xUMhMyWFE/yccll/ISCTh6Y1 7azoID+eev5sS9vo8VKvKAC9y X-Received: by 2002:a62:1b92:0:b0:3eb:3f92:724 with SMTP id b140-20020a621b92000000b003eb3f920724mr35757520pfb.3.1634096508717; Tue, 12 Oct 2021 20:41:48 -0700 (PDT) X-Received: by 2002:a62:1b92:0:b0:3eb:3f92:724 with SMTP id b140-20020a621b92000000b003eb3f920724mr35757499pfb.3.1634096508378; Tue, 12 Oct 2021 20:41:48 -0700 (PDT) Received: from t490s ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v13sm12837847pgt.7.2021.10.12.20.41.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 20:41:47 -0700 (PDT) Date: Wed, 13 Oct 2021 11:41:40 +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 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 mention about why soft offline does not need that extra bit, which seems not obvious as well, so imho good material for commit messages. Sorry to have asked for a lot of commit message changes; I hope they make sense. Thanks, -- Peter Xu