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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62305C433EF for ; Tue, 15 Feb 2022 20:09:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A445F6B0078; Tue, 15 Feb 2022 15:09:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F3876B007B; Tue, 15 Feb 2022 15:09:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E3946B007D; Tue, 15 Feb 2022 15:09:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 80D0C6B0078 for ; Tue, 15 Feb 2022 15:09:45 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3B2E695CA5 for ; Tue, 15 Feb 2022 20:09:45 +0000 (UTC) X-FDA: 79146104730.13.590804A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf09.hostedemail.com (Postfix) with ESMTP id 477D6140008 for ; Tue, 15 Feb 2022 20:09:44 +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=2KQX3ZqOWXcG/3O/Gh0GTURDssFoJ1a3or/9OceS26E=; b=rbB7JRyQFJ/jgIJcJQyNMyc2t2 EoY85nSHooSpI246/gddkgdpg2tRu/kt/Hax6Ve6xtSeK/mvUR5KK43fMZ6fZz69F4yzq+MnxHQ4A wLr6QAscYDgb8MX+QmBHMEAu0jE8yQayq0Pmthg6dOCxQdNb3Me9X43/Me+CL9hm0cC0jxdoSZhbt RJb2NGo0xD1PeqJIsVzPO+J1LbaJy1PP7q4GyhyQMLCdRasmA+Z/cKWYYUWYPxcdy7PTuPnrx4E5D hE7jl1/OeXLD5XhBkAUnUVp+0XjFLENpyWjqT34GanLUw6xPo4gV5Qck9QqCUbpbQlR+/hCN3Zb7M V+ljUSPw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nK48n-00E8hH-1K; Tue, 15 Feb 2022 20:09:37 +0000 Date: Tue, 15 Feb 2022 20:09:37 +0000 From: Matthew Wilcox To: Miaohe Lin Cc: Linux FS-devel Mailing List , Linux-MM Subject: Re: [PATCH 02/10] mm/truncate: Inline invalidate_complete_page() into its one caller Message-ID: References: <20220214200017.3150590-1-willy@infradead.org> <20220214200017.3150590-3-willy@infradead.org> <71259221-bc5a-24d0-d7b9-46781d71473a@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71259221-bc5a-24d0-d7b9-46781d71473a@huawei.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 477D6140008 X-Stat-Signature: 5o9qmridm33i1wn6ai19qm1xi8z8zsa9 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=rbB7JRyQ; dmarc=none; spf=none (imf09.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1644955784-558687 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 Tue, Feb 15, 2022 at 03:45:34PM +0800, Miaohe Lin wrote: > > @@ -309,7 +288,10 @@ int invalidate_inode_page(struct page *page) > > return 0; > > if (page_mapped(page)) > > return 0; > > - return invalidate_complete_page(mapping, page); > > It seems the checking of page->mapping != mapping is removed here. > IIUC, this would cause possibly unexpected side effect because > swapcache page can be invalidate now. I think this function is > not intended to deal with swapcache though it could do this. You're right that it might now pass instead of being skipped. But it's not currently called for swapcache pages. If we did want to prohibit swapcache pages explicitly, I'd rather we checked the flag instead of relying on page->mapping != page_mapping(page). The intent of that check was "has it been truncated", not "is it swapcache".