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 C1C24C433EF for ; Wed, 16 Feb 2022 02:36:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B9906B0078; Tue, 15 Feb 2022 21:36:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 141E76B007B; Tue, 15 Feb 2022 21:36:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F09C16B007D; Tue, 15 Feb 2022 21:36:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id DEE4B6B0078 for ; Tue, 15 Feb 2022 21:36:35 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id B1BB3120A26 for ; Wed, 16 Feb 2022 02:36:35 +0000 (UTC) X-FDA: 79147079550.04.A1BE6E8 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf24.hostedemail.com (Postfix) with ESMTP id E52B2180003 for ; Wed, 16 Feb 2022 02:36:34 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jz26L1TY2zZfTp; Wed, 16 Feb 2022 10:32:10 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 16 Feb 2022 10:36:31 +0800 Subject: Re: [PATCH 02/10] mm/truncate: Inline invalidate_complete_page() into its one caller To: Matthew Wilcox CC: Linux FS-devel Mailing List , Linux-MM , HORIGUCHI NAOYA References: <20220214200017.3150590-1-willy@infradead.org> <20220214200017.3150590-3-willy@infradead.org> <71259221-bc5a-24d0-d7b9-46781d71473a@huawei.com> From: Miaohe Lin Message-ID: <5aba3dfc-9483-bf4b-9f31-b513ce972035@huawei.com> Date: Wed, 16 Feb 2022 10:36:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E52B2180003 X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: mmtni7jgongpy5h5zo9z91ewkjge6xf5 X-HE-Tag: 1644978994-173597 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 2022/2/16 4:09, Matthew Wilcox wrote: > 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 AFAICS, __soft_offline_page might call invalidate_inode_page for swapcache page. It only checks !PageHuge(page). Maybe __soft_offline_page should change to check the flag or maybe it's fine to invalidate swapcache page there. I'm not sure... > to prohibit swapcache pages explicitly, I'd rather we checked the > flag instead of relying on page->mapping != page_mapping(page). Agree. > The intent of that check was "has it been truncated", not "is it > swapcache". Many thanks for clarifying this. > > > . >