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 ADA31C433EF for ; Thu, 21 Oct 2021 01:38:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 313E4611CE for ; Thu, 21 Oct 2021 01:38:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 313E4611CE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 8A3D4900002; Wed, 20 Oct 2021 21:38:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8051E6B0072; Wed, 20 Oct 2021 21:38:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A4CB900002; Wed, 20 Oct 2021 21:38:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0243.hostedemail.com [216.40.44.243]) by kanga.kvack.org (Postfix) with ESMTP id 578696B0071 for ; Wed, 20 Oct 2021 21:38:45 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 19DCC18045D0B for ; Thu, 21 Oct 2021 01:38:45 +0000 (UTC) X-FDA: 78718735410.26.082BE59 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 6907DD0425FE for ; Thu, 21 Oct 2021 01:38:42 +0000 (UTC) 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: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6907DD0425FE X-Stat-Signature: arir88i9kkbsfr3tifeo5r97ohs9q3aa Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=h5eNVqpj; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1634780322-798490 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 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.