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 27FC4C433F5 for ; Fri, 1 Apr 2022 06:15:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73CDC6B0073; Fri, 1 Apr 2022 02:15:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6ED156B0075; Fri, 1 Apr 2022 02:15:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B4786B0078; Fri, 1 Apr 2022 02:15:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 480A06B0073 for ; Fri, 1 Apr 2022 02:15:05 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EE317A6303 for ; Fri, 1 Apr 2022 06:14:54 +0000 (UTC) X-FDA: 79307296950.22.97E6014 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf17.hostedemail.com (Postfix) with ESMTP id 0E72540026 for ; Fri, 1 Apr 2022 06:14:53 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KV8yZ2xRnz1HBL5; Fri, 1 Apr 2022 14:14:30 +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; Fri, 1 Apr 2022 14:14:49 +0800 Subject: Re: [PATCH 5/8] mm/vmscan: use helper folio_is_file_lru() To: "Huang, Ying" CC: , , , Joonsoo Kim , Konstantin Khlebnikov , Wu Fengguang References: <20220329132619.18689-1-linmiaohe@huawei.com> <20220329132619.18689-6-linmiaohe@huawei.com> <87y20pa3r6.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Miaohe Lin Message-ID: <191fa86c-2548-d136-19f5-3e0a744b6da9@huawei.com> Date: Fri, 1 Apr 2022 14:14:49 +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: <87y20pa3r6.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-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 6dja3gn9yjro79h5fq8p8ru3wmkbquke Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Queue-Id: 0E72540026 X-HE-Tag: 1648793693-832798 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/4/1 11:20, Huang, Ying wrote: > Miaohe Lin writes: > >> Use helper folio_is_file_lru() to check whether folio is file lru. Minor >> readability improvement. >> >> Signed-off-by: Miaohe Lin >> --- >> mm/vmscan.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/mm/vmscan.c b/mm/vmscan.c >> index ebd8ffb63673..31e95d627448 100644 >> --- a/mm/vmscan.c >> +++ b/mm/vmscan.c >> @@ -1411,14 +1411,14 @@ static enum page_references folio_check_references(struct folio *folio, >> /* >> * Activate file-backed executable folios after first usage. >> */ >> - if ((vm_flags & VM_EXEC) && !folio_test_swapbacked(folio)) >> + if ((vm_flags & VM_EXEC) && folio_is_file_lru(folio)) > > I think that this should be converted to > > if ((vm_flags & VM_EXEC))) > > We should activate swap-backed executable folios (e.g. tmpfs) after > first usage too. > Dig into the git history, we can found that commit c909e99364c8 ("vmscan: activate executable pages after first usage") activate swap-backed executable folios after first usage too. But later swap-backed executable folios is not activated via commit b518154e59aa ("mm/vmscan: protect the workingset on anonymous LRU") to pretect the workingset from anonymous LRU. So above change might not be wanted. Or am I miss something? Many thanks. > Best Regards, > Huang, Ying > >> return PAGEREF_ACTIVATE; >> >> return PAGEREF_KEEP; >> } >> >> /* Reclaim if clean, defer dirty folios to writeback */ >> - if (referenced_folio && !folio_test_swapbacked(folio)) >> + if (referenced_folio && folio_is_file_lru(folio)) >> return PAGEREF_RECLAIM_CLEAN; >> >> return PAGEREF_RECLAIM; > . >