From patchwork Thu Mar 2 14:49:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157363 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 19133C678D4 for ; Thu, 2 Mar 2023 14:29:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B1946B0075; Thu, 2 Mar 2023 09:29:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 961B26B0078; Thu, 2 Mar 2023 09:29:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 850D96B007B; Thu, 2 Mar 2023 09:29:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 768916B0075 for ; Thu, 2 Mar 2023 09:29:12 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 54E1A140267 for ; Thu, 2 Mar 2023 14:29:12 +0000 (UTC) X-FDA: 80524190544.28.C913B20 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf25.hostedemail.com (Postfix) with ESMTP id 31080A001F for ; Thu, 2 Mar 2023 14:29:08 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677767350; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=Z2VtlejJQUVI6btVxDqpwb24r7VVC9zOmonVzo8yC2E=; b=7f7rLEFV6E17JXM6/3acqa8RePS/kcQChsjg7vY+bKvfyPuEkYWCvDLdVuO/OKBR/ItTUI yl33UiFVch8/9QqPwDMA3mFgaUnb8EvXz/uCPtc1ea7Ef1GAsIoqdrBs8N0fjaRVroA8zZ dYlD8z+5j4YlBv6F5i8utYgoVCBPN/Q= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677767350; a=rsa-sha256; cv=none; b=E0Q/mPdXK0OAflD08hD1ctswik3V5IcrVu++2chYLFG3rBNF0e2d4O7eOsgB4gswWdkVot tfoc8/ZO3Od5HxcqTXx4IZFnBEQ3goFhkSURfl0SQaSMSbxE30wG82mTYTqEWzyQM6Bpvy NUNHHXdz/Ujns8WWqhyHGYrb6rbQREQ= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PSCyq3R4pzKmK3; Thu, 2 Mar 2023 22:24:03 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 22:29:03 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH -next] mm/damon/paddr: minor refactor of damon_pa_pageout() Date: Thu, 2 Mar 2023 22:49:26 +0800 Message-ID: <20230302144926.40012-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 31080A001F X-Stat-Signature: xyb8yj6o68kq74arbe758bkfo1gyt3tw X-HE-Tag: 1677767348-324872 X-HE-Meta: U2FsdGVkX189l394r7DDskIaULdENYotyoIfrc3859/aqPxlDbrYAeaomHdisGAr8YXGYwcr5ak6suzraaOQYnk4/wvGlp3flcTtic84Vmn7KUoTVSZ9O00TipGXzmJoimnMamCueD2ouZ7T/rQ5foBEoxmw2CHWhAD0rK3lRmhqiaSkfAJcZ71FlPae/kUm0C7KGq2u1sK5FHOQdovTi0g1m3lGr73L2x+vM5KZl/Ga3hfLvbvMfmK/9v17j2CkbpgEiDX9uIl1YB7jSRFbO3T9voHki94yRWB/DuIxnKAwhlMbMM3qJIkAECq5HgUr5jn6wHSASZWuLs+IYlbNAQYPUxu9yVQod+Wko7I2d8WU4hJ9EN/JufxiBcLfcToH4so/hjUmgb5rksHoSM0l/vuFuwybvCZ1ID461PuIqhsB4uZuqolKVJrKNxddyAs503pJJqydMxmFY/LGQDjkFE2Hri/MH1V09pUgltnMg+R2iOGiQVxmhf2ilpDMGvkf4+muflwwAqgwGKlthuPGzzayWOWnbDDYjMLfSo/lD2jRDGf3cT/INKUViAdF9lcw3DFzfPaj5CVWhVwiPAmL3z3a3h2cXE2POmgOUP7D38XU8Tpugd+vWkcgb8FjcfTOKgEVBABjmlaD37ptLjpkIHVvdNpHhJtedD6Qg/2sNrLukF0zh1wLVz80kkDW/ramkO+tmdqHqk85KN/gdkQ3jo95g85kmlJAkgp4PcyOWi3nPbc3OYmFKumAnmkPTboTaA2UBFMmywhHWU5P/G9xK97ccW43xcAXfICDza5kfASG6v6DbERBAfffmRRaey6pV5EV2IGghurHWM/HEoYQK5WKOVLtGHQGX0NFVLqJmlLqSHeR/Nxwg9dEyu/qBnXDZFRtikGkuwPL3z7Kjv9kpYQVRk8UNaLzacLvzb8kqIr5DAKvfdkHuf0l32H23iwKFpkwFHnBklOS1IOxbZ+ O02vL15C xTCAHOpDVsYmOzlCHIqauDSw7LE23pbOXjqM4p7eG7LpgI2/11/+jvzLd/6QEUD877Eic5TMl2rrlRC91P+2ppCqnk+l1febAqCBcoZSzmQZTx3NGDoTQYGtZms1xWI/VK31rJmCu2ZohqcsvOYhMIZu1ypc1BYJnOndCINq/UaZ0ROgSXAofAz5WyHqxVeZQo0MpUTTBaRBneG5O9e3DRNEUsQ== 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: Omit two lines by converting if(!folio_isolate_lru()) to if(folio_isolate_lru()). Signed-off-by: Kefeng Wang --- mm/damon/paddr.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 6c655d9b5639..a557f3c9300f 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -246,14 +246,12 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) folio_clear_referenced(folio); folio_test_clear_young(folio); - if (!folio_isolate_lru(folio)) { - folio_put(folio); - continue; + if (folio_isolate_lru(folio)) { + if (folio_test_unevictable(folio)) + folio_putback_lru(folio); + else + list_add(&folio->lru, &folio_list); } - if (folio_test_unevictable(folio)) - folio_putback_lru(folio); - else - list_add(&folio->lru, &folio_list); folio_put(folio); } applied = reclaim_pages(&folio_list);