From patchwork Fri Mar 3 08:43:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13158398 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 85DE5C678D4 for ; Fri, 3 Mar 2023 08:23:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 112686B007B; Fri, 3 Mar 2023 03:23:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C1AD6B0078; Fri, 3 Mar 2023 03:23:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECAEA6B007B; Fri, 3 Mar 2023 03:23:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D49A06B0075 for ; Fri, 3 Mar 2023 03:23:01 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A74F9AB8E0 for ; Fri, 3 Mar 2023 08:23:01 +0000 (UTC) X-FDA: 80526896562.25.A5ED34D Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf28.hostedemail.com (Postfix) with ESMTP id 6BF90C0011 for ; Fri, 3 Mar 2023 08:22:58 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677831779; 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:in-reply-to:references:references; bh=y1434TH914/XkXlPb4/bO9w69xsgM/XMN6HmD7zOhzg=; b=T2+0GnUbtJnEhMeb9TYgltl6X/795EH3ZqkU+yOD+OSYMuMLpEIg19tr6j4/CriGHaqb7R 8iPW7jAC7f+rmS0EVaVo/P1nEnR5eq5fKv7ncKg8Ld1EpAjx/HzCYxovM4GteGiO2GkAKR 0XSu/zlN9nQfnc76Lqf2qgsFhtXggx0= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677831780; a=rsa-sha256; cv=none; b=s/6+79hIvhthWGUv14GDpQ3x7cL8hss92oMhwMFpvQjC8ls5uugXghBPTFCVvqSfVtjCGV qZQKIXn9/zR4IKEIIWEm6wEpj7ktNv/e2Ktu63kd+OGPgbisBJOz04drpqm/sj1ZDsb3l9 U3mdQ+DlE7Uj8elFuGXr5TpZa+TEhys= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PSgsH0XMrz9tJH; Fri, 3 Mar 2023 16:20:51 +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; Fri, 3 Mar 2023 16:22:46 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH v2 1/3] mm/damon/paddr: minor refactor of damon_pa_pageout() Date: Fri, 3 Mar 2023 16:43:41 +0800 Message-ID: <20230303084343.171958-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230303084343.171958-1-wangkefeng.wang@huawei.com> References: <20230303084343.171958-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Stat-Signature: jb8tb8diyh8n15fwuhdee9si4s637nkt X-Rspam-User: X-Rspamd-Queue-Id: 6BF90C0011 X-Rspamd-Server: rspam06 X-HE-Tag: 1677831778-402289 X-HE-Meta: U2FsdGVkX188Cifcf+1b0kmmF+eMcADoSb/0InNzJl/s+T2fRAUCynCASZfeQaFW/SC8o1VPMFoPjqKmCvj4Go0wEQAi6ikBaSaoS5P7EYEFp9dJ11yzeqe8fdxYphb9BMSdVoI4g2GzsFQYLieSzkI8f1A4T5xWqk4KCG2aWy/M+7x0IPPrj2sWI/KXFk+HMfJ3D/qem5muPw/KtezQCBftmDtpT/d4QB8vPtn/Dotc/8sa2Z7ZMPXYVKOkjGa33Rng9lglKTVN1mG0yv/LcgOB7TiE5jAfWHTKb6KrWRheZmrZBZj2vAn/RS/Fr0Vm2YP1MyLW9O0jJNzQHFfvPyREgXX7S9+rfjCrDUH9RXnqI9K2A8Zt0/DoJXbeNvMFlGVys5ysOvQtmdGRNSjHeF1wW6LDdjjMMLEcCzZYTrQq3rqiBLkHbseN62myulYQQETjC0Xx4AMMsTagNnCWFtZU+BIpU6jjjuuJS2n/W6fYzOiGAcaitErORmeWZ4Bn16Q9oDvzC95FMtdkL5dOKwpFH4OejRM1Yz6FOlef95/oxBrL1qW9EnwO4WFucRBGtRbQzasYvoTGW/Og3lu5SL93PMQ3SLYCg+Htq+V6udA9vPxarNJp3aS5WiwxXofKsDsu7jljMq3gMG5hwIYtiw6suyTAhNHJVw5ZrnRrtipjmP2xCTHCyQL0qdXtC7iWm9tR6tdao8mQi2eirP4IPLMWaoxf5Sj9VRyeiLV3Vp7F3qkgnZUfWXsJ7I82dftvp4/tBwEQnCJh4crmaldGeBRec1nA70KxsMbKohDIXE7+4UJBteH0l0PO4pDFVplqmsNJDyA8in36vKu523UKxBDOEvdePznoD7orISQZX8tdH++rN3O0j1trlWLm27fQmPlMwSM2pObUsEfL8gCJNgVzQxowBpSJVtkLa4JvxWFUFVIOe8J4SfnM4zHZWuC2T5BQBCoYldjHDQ9TKYk H1kPtQI4 RwDzKZHGFq9j/r2jPyUzAsD/5z/C03ZHwIzseVdzBQeDCX6FZdiCoTZTT+6RVDNoSe1wfEIM09aXJJ+MftDj0hFo9NlkQAtsQ/h6ofpfKJWU/Lf0foHKcnyIr/mkNTvHZyCzx9RmWCRT+5LsCiAcK5f8XEPrIZXaFwEr0N6i9gO0uWwG4li2ZoyMpno8+nChSZlu1y3X1zR7DelxEaAIifiYwWg== 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 three lines by unified folio_put(), and make code more clear. Signed-off-by: Kefeng Wang Reviewed-by: SeongJae Park --- mm/damon/paddr.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 6c655d9b5639..3fda00a0f786 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -239,21 +239,18 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) if (!folio) continue; - if (damos_pa_filter_out(s, folio)) { - folio_put(folio); - continue; - } + if (damos_pa_filter_out(s, folio)) + goto put_folio; folio_clear_referenced(folio); folio_test_clear_young(folio); - if (!folio_isolate_lru(folio)) { - folio_put(folio); - continue; - } + if (!folio_isolate_lru(folio)) + goto put_folio; if (folio_test_unevictable(folio)) folio_putback_lru(folio); else list_add(&folio->lru, &folio_list); +put_folio: folio_put(folio); } applied = reclaim_pages(&folio_list);