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 4206DC433F5 for ; Thu, 31 Mar 2022 08:07:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2F2C6B0072; Thu, 31 Mar 2022 04:07:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ADEBC6B0073; Thu, 31 Mar 2022 04:07:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97EB96B0074; Thu, 31 Mar 2022 04:07:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 863A86B0072 for ; Thu, 31 Mar 2022 04:07:28 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 47523A5D36 for ; Thu, 31 Mar 2022 08:07:28 +0000 (UTC) X-FDA: 79303951776.16.B770B29 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf24.hostedemail.com (Postfix) with ESMTP id 5359E180007 for ; Thu, 31 Mar 2022 08:07:27 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KTbVw3sYNzVfj9; Thu, 31 Mar 2022 16:07:04 +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; Thu, 31 Mar 2022 16:07:23 +0800 Subject: Re: [PATCH 1/8] mm/vmscan: remove redundant folio_test_swapbacked check when folio is file lru To: "Huang, Ying" CC: Andrew Morton , Linux Memory Management List , LKML , Muchun Song References: <20220329132619.18689-1-linmiaohe@huawei.com> <20220329132619.18689-2-linmiaohe@huawei.com> <87lewqbpad.fsf@yhuang6-desk2.ccr.corp.intel.com> <7c8d06f6-ac41-d3d7-f6b6-20a06e56dc61@huawei.com> <87czi2bldb.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Miaohe Lin Message-ID: Date: Thu, 31 Mar 2022 16:07:22 +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: <87czi2bldb.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected 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-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5359E180007 X-Stat-Signature: 4nbkkezc9c9jkntwxd1nzo7r37ysd3cx X-HE-Tag: 1648714047-159732 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/31 16:02, Huang, Ying wrote: > Miaohe Lin writes: > >> On 2022/3/31 14:37, Huang, Ying wrote: >>> Muchun Song writes: >>> >>>> On Tue, Mar 29, 2022 at 9:26 PM Miaohe Lin wrote: >>>>> >>>>> When folio is file lru, folio_test_swapbacked is guaranteed to be true. So >>>>> it's unnecessary to check it here again. No functional change intended. >>>>> >>>>> Signed-off-by: Miaohe Lin >>>>> --- >>>>> mm/vmscan.c | 3 +-- >>>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>>> >>>>> diff --git a/mm/vmscan.c b/mm/vmscan.c >>>>> index 1678802e03e7..7c1a9713bfc9 100644 >>>>> --- a/mm/vmscan.c >>>>> +++ b/mm/vmscan.c >>>>> @@ -1434,8 +1434,7 @@ static void folio_check_dirty_writeback(struct folio *folio, >>>>> * Anonymous pages are not handled by flushers and must be written >>>>> * from reclaim context. Do not stall reclaim based on them >>>>> */ >>>>> - if (!folio_is_file_lru(folio) || >>>>> - (folio_test_anon(folio) && !folio_test_swapbacked(folio))) { >>>>> + if (!folio_is_file_lru(folio) || folio_test_anon(folio)) { >>>> >>>> At least your login is no problem since folio_is_file_lru() is equal to >>>> !folio_test_swapbacked(). But the new code is not clear to me. >>>> The old code is easy to understand, e.g. folio_test_anon(folio) && >>>> !folio_test_swapbacked(folio) tells us that the anon pages which >>>> do not need to be swapped should be skipped. >>> >>> That is for MADV_FREE pages. The code is introduced in commit >>> 802a3a92ad7a ("mm: reclaim MADV_FREE pages"). >>> >>> So I think the original code is better. It's an implementation detail >>> that folio_is_file_lru() equals !folio_test_swapbacked(). It may be >>> better to add some comments here for MADV_FREE pages. >>> >> >> Do you tend to drop this patch or adding a comment with the change in this patch or something else? > > I suggest to drop the code change and add a comment about MADV_FREE. Will do. Thanks. > > Best Regards, > Huang, Ying > >> Thanks. >> >>>> So I'm neutral on the patch. >>> >>> Best Regards, >>> Huang, Ying >>> . >>> > . >