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 C0B22C433EF for ; Mon, 7 Mar 2022 12:44:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A11F8D0002; Mon, 7 Mar 2022 07:44:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 350268D0001; Mon, 7 Mar 2022 07:44:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 240E98D0002; Mon, 7 Mar 2022 07:44:52 -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 17DC38D0001 for ; Mon, 7 Mar 2022 07:44:52 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id D83CF81CAE for ; Mon, 7 Mar 2022 12:44:51 +0000 (UTC) X-FDA: 79217559582.07.499726B Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id C26BEC0006 for ; Mon, 7 Mar 2022 12:44:50 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KByhv6tWfzbbq5; Mon, 7 Mar 2022 20:39:59 +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; Mon, 7 Mar 2022 20:44:45 +0800 Subject: Re: [PATCH 10/16] mm/migration: remove PG_writeback handle in folio_migrate_flags To: Andrew Morton CC: , , , , , , , , , , , , , , , , , References: <20220304093409.25829-1-linmiaohe@huawei.com> <20220304093409.25829-11-linmiaohe@huawei.com> <20220306172121.50d00e8b328a6bd1dea91ee7@linux-foundation.org> From: Miaohe Lin Message-ID: <536b80dc-a37a-a5dd-fd9c-a1240dac3286@huawei.com> Date: Mon, 7 Mar 2022 20:44:45 +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: <20220306172121.50d00e8b328a6bd1dea91ee7@linux-foundation.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C26BEC0006 X-Stat-Signature: 3ncbqzjbyb1sxzqyn3aijckcph4f7ha9 Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-HE-Tag: 1646657090-260210 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/3/7 9:21, Andrew Morton wrote: > On Fri, 4 Mar 2022 17:34:03 +0800 Miaohe Lin wrote: > >> When newfolio reaches here, it's guaranteed that PG_writeback is not set >> because caller ensures writeback must have been completed. Remove this >> unneeded check and cleanup the relevant comment. > > What guarantees that writeback cannot start after the caller has checked? Drivers should set writeback flag under page lock. But I'am not sure this is always obeyed. > > I see no such check in iomap_migrate_page()? iomap_migrate_page acts as a migratepage callback. The check is actually done in __unmap_and_move. > >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -549,18 +549,6 @@ void folio_migrate_flags(struct folio *newfolio, struct folio *folio) >> if (!folio_test_hugetlb(folio)) >> folio->private = NULL; >> >> - /* >> - * If any waiters have accumulated on the new page then >> - * wake them up. >> - */ >> - if (folio_test_writeback(newfolio)) >> - folio_end_writeback(newfolio); IIUC, this should also be broken too. If a page can be flagged writeback under page lock, we can't simply do folio_end_writeback here as page might still be under the use of drivers. More works should be done to handle the case correctly. >> - >> - /* >> - * PG_readahead shares the same bit with PG_reclaim. The above >> - * end_page_writeback() may clear PG_readahead mistakenly, so set the >> - * bit after that. >> - */ >> if (folio_test_readahead(folio)) >> folio_set_readahead(newfolio); >> > > folio_migrate_flags() and folio_migrate_copy() are global, > export-to-modules functions but have no interface documentation. That > was bad of us. > > I wonder why those two functions are exported to modules anyway. That's really a pity. > . > Many thanks for your comment and reply!