Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp149754pxb; Wed, 20 Oct 2021 18:41:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7qkfVzVmFcpyYi6wc34kZ41gGoXliSot5hPr/WAMWFWzSrkLXMHuJNZaGcQdbezb7L31H X-Received: by 2002:a17:906:f2d0:: with SMTP id gz16mr3591112ejb.102.1634780498855; Wed, 20 Oct 2021 18:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634780498; cv=none; d=google.com; s=arc-20160816; b=iiPr0rU9PAWyJP7HmNnFaA4vNXeoAwUlwkwhj8stxpcbEje33dS76O9hBeMmMe5W5v fFUScJ5DSbN9W/RVPDpTr99eaqJ257TBk5h1icDS1LRVkbev+q33XNFT59Jf3f2BBKbz mPVqOC0QjIYfC+wicKPohJxTroQ6JfUvzFKYSVr74X/V5Hrv4DvclJ+VLAUitlgBf13N 6gsfzRuffE6yjsrzXe9R7EbCjJ4wdYB1PLjJWEwRjpvnbVEnE+bJzPpPKCw/WLCQZkVl hlmCc5+Hb/8YFYOxySj/rPc16UFFSMNiA6+A5Oil3dyqkTpikFqyZ39oas99CXhwdseM dvkg== 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=6sNM52S6yqayIv2yY7yJuKuW9m7X8R2dexRIUmUEaSQ=; b=JLr5/V/pvVnJGdj4mSQZCMu5MCk6fs9M8J3ZzJeU8Yp+yS27fATeJGTRFbAdgZ44jI MVIEIHS8g5grwYd5CMQBhjD9nEmHN1VOnUH/oDrILugIZY+PeDq3l9+Eo+UF9WxVyxFy 1IYd2M8aysHQqUQg/p8NK5Qf+zGv3lT8zo2CguS+L6TYoblhKR3EwmZZzCiqWZGrTURE QICAYz6KvvcaiIglrokljnyXoYol/Mzd2YNOx9CDiVvNMwycoP6Oc+O+d3rJ2QzAD/UQ k5A4Zw9k5bTlkB+zyYfvt1zdczJKVdYlSW4iNY0zFbFejGoa3QEniBd2+VX045bD02E5 2QeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=h5eNVqpj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg12si6305025ejc.536.2021.10.20.18.40.27; Wed, 20 Oct 2021 18:41:38 -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=@infradead.org header.s=casper.20170209 header.b=h5eNVqpj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230290AbhJUBlA (ORCPT + 99 others); Wed, 20 Oct 2021 21:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbhJUBk7 (ORCPT ); Wed, 20 Oct 2021 21:40:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382E0C06161C; Wed, 20 Oct 2021 18:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6sNM52S6yqayIv2yY7yJuKuW9m7X8R2dexRIUmUEaSQ=; b=h5eNVqpjFT832hI3aZzaYiF9k+ 0z301mRAcOVRIZ1kAEnAMi3eCSZokNNxPEvmTBV6UKqmJs8+lXeKPHQZTWbt320ovZ+I7aF0Mr6SC uY9+iOYmgC143tI2Nh+rZ4oSzi+aFboK2KYehhE7k4D+XQq3HeXZsBaKogqvnRXSFirjC/wcgdyxW 4BYM0kfrJRhskwZQH8QftJ8gGqbIvzfphD2yrTAEgyE7NyP39ZxTAkZ2f69+BNZZPGigRc43HrwSY 2HsVy1lOiRmH6kRALNlU+aYFy8G67Tcf1IiNOOPGdbP7YFn/9Ve369+YRB4kaEdI1/eYwZ9hc1eFD yyPs6rvw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdN0j-00Cxoq-UE; Thu, 21 Oct 2021 01:37:28 +0000 Date: Thu, 21 Oct 2021 02:36:49 +0100 From: Matthew Wilcox To: Yang Shi Cc: Hugh Dickins , Song Liu , Andrew Morton , Hao Sun , Linux MM , Linux FS-devel Mailing List , Linux Kernel Mailing List , Song Liu Subject: Re: [PATCH] fs: buffer: check huge page size instead of single page for invalidatepage Message-ID: References: <20210917205731.262693-1-shy828301@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 05:24:09PM -0700, Yang Shi wrote: > On Wed, Oct 20, 2021 at 4:51 PM Matthew Wilcox wrote: > > > > On Wed, Oct 20, 2021 at 04:38:49PM -0700, Yang Shi wrote: > > > > However, it still doesn't make too much sense to have thp_size passed > > > > to do_invalidatepage(), then have PAGE_SIZE hardcoded in a BUG > > > > assertion IMHO. So it seems this patch is still useful because > > > > block_invalidatepage() is called by a few filesystems as well, for > > > > example, ext4. Or I'm wondering whether we should call > > > > do_invalidatepage() for each subpage of THP in truncate_cleanup_page() > > > > since private is for each subpage IIUC. > > > > > > Seems no interest? > > > > No. I have changes in this area as part of the folio patchset (where > > we end up converting this to invalidate_folio). I'm not really > > interested in doing anything before that, since this shouldn't be > > reachable today. > > Understood. But this is definitely reachable unless Hugh's patch > (skipping non-regular file) is applied. Right. That's the bug that needs to be fixed. Seeing THPs here is a symptom. Getting rid of the error just makes the problem silent. > > > Anyway the more I was staring at the code the more I thought calling > > > do_invalidatepage() for each subpage made more sense. So, something > > > like the below makes sense? > > > > Definitely not. We want to invalidate the entire folio at once. > > I didn't look at the folio patch (on each individual patch level), but > I'm supposed it still needs to invalidate buffer for each subpage, > right? No. Buffers are tracked for the entire folio, not on each subpage. Actually, the filesystem people currently believe that the O(n^2) nature of buffer-head handling mean that it's a bad idea to create multi-page folios for bufferhead based filesystems (which includes block devices), and the correct path forward is to migrate away from buffer-heads. That may change, but it's the current plan.