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); From patchwork Fri Mar 3 08:43:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13158397 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 B1FC2C7EE32 for ; Fri, 3 Mar 2023 08:23:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 44D3E6B0074; Fri, 3 Mar 2023 03:23:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CEC16B007B; Fri, 3 Mar 2023 03:23:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FA5A6B0074; Fri, 3 Mar 2023 03:23:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0BE486B0073 for ; Fri, 3 Mar 2023 03:23:00 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C57311411DB for ; Fri, 3 Mar 2023 08:22:59 +0000 (UTC) X-FDA: 80526896478.09.6BB2946 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf30.hostedemail.com (Postfix) with ESMTP id 90CD180006 for ; Fri, 3 Mar 2023 08:22:56 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.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=1677831778; a=rsa-sha256; cv=none; b=n53Qtpkjp/LME/pZws31Ww3T+qw8GU2/pk/QSswQGkfpL3E9yzbmmiwcfZPRy0sSE3XVr9 8fz6GPeMv3fVHSjLJaxiINuXyoaHlrpA8kk2kbUiiIIPAID/HH0yhzv5yqdxMOAy0aPjs4 s2aK+6MGC5X4L02R+VQMnlkSd9Who8k= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.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=1677831778; 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=F7kRQcf8rYI3p2XX72xLIeZ9I3gh+WTwueyptmTV+AM=; b=VKaAeOyuy8KvSxF/4VPUt+niaQYYOFbhYGYK7FTduLITlT95Nehj2tikDnYDJAtZxDjHaT fKVB4PkwL8EoUYkhBNwKRK7KZ+jr1etmoMbkGRW070XDRRcFhFByv0UEGZfr+2ljqhkq1l 5ir9rac61tCviHps0zYKTNbnUggYXwc= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PSgsH2FF9z9tKK; 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:47 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH v2 2/3] mm/damon/paddr: minor refactor of damon_pa_young() Date: Fri, 3 Mar 2023 16:43:42 +0800 Message-ID: <20230303084343.171958-3-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-Rspam-User: X-Rspamd-Queue-Id: 90CD180006 X-Rspamd-Server: rspam01 X-Stat-Signature: 739o3hextugqhnkue6yybte9n7e7f7mu X-HE-Tag: 1677831776-424121 X-HE-Meta: U2FsdGVkX18D4i0mLG3ENrGi6IYMVb91mOr3ta+Mzb4BqxFwfp3K4Swr4EpZTLxRAzlcoRsPXA8jEgVXIYx+K+6CIHS2d0jmsCQI7ZrPvGqRNqNaMBbBz1NM8sA4kUzwsd+iensjOsb2vTEVoR4vP0fjUmOt7FoEqYeE3BmxzSosptCQqEPiNUmr/dMGEE1bGVCYgsKLZ6jwvT7GQkhTMHerpJ2CfQhj7EOBFYRCPAPhzVVVaWBS0nILGw+xaaPeNuxzU+jnf9+7hkX8PMDxvralkGoThnbrsoNkXghxUuF/HgqtLiNUF9dHljH7TuvUs2DYbPGGhZPeczNAHb3WhUlj+T9TasgOrn4qcxJG++KhaOfIAk8vnkwVibpAsgnI2t8YmhBNeFmYY6XGvYeIwvPQqm2Woz39Fk+AWWp0i0IGN+9tNnlXHrduTblbs6/nSHX8RtnFvuV+e7pCCA0DbOVX2uaWySSZaIKkozg+HgXIxsrZFA7lzNBKu/k4blBIYEryEwh3mPOGyp0jjlh4Y1B/HH9NHBAnYJX/VSxfgA90URiguCC6q5YmPlv4/QUqI8z3wunC/pzqsDp4AooALU59KKPhok1W4T3epbG3wacc2IBEBoKIoZOCTVgppy6XNqyVKC+Rcw2zU9IVWGPwT96cGuNILhE7b4HWKKNFT+/Hyg+n8ujgNYtvV8IkM+u/BGTB69IDxFfZnOgFxlXVkw2S/LWfdXrACWr5x2nmuvIVTfDDW52x+kGwWqoHn+ZiU0TAFUrvNhYeQll6JCRPnBjAFSFT5xzt5QaQIc/3O7xLkSDZAbHiaSUzRy5tUPMxoKdszzrX6eCipUY8pSFLhCDTq6SQlvdMIOMIBfj5mjOE8LLoSn+mvsTldc6NK+X0D+kTtBBk1HgBaSrWOjvwITeQov4kKwCJL36MrZXi/zXh55RbjsQngZZBIfazNn2IV1Go8YWqRZnHWs6uc0p ErBOwPCm pfRR1ifI8rU1oS7VcDgwPHrpcnEk3oqhXpBX3uOewCIF61IdEGi5KkPqz2qa2emh5CVyUxS2mqvC6hIOmXUuI3DGKZkqPA3PWbKZLjReNd38acT/f8IEfUnHipAkzHzY5Sr1ha7fDNj8pXQem2oWKe27xqM6D4M4hL13/LWN8pjUU9aRNCwMJbLu7AfKf0AnZsPFXpDveyKr+1SbwbdyUVVJ1UQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000038, 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 --- mm/damon/paddr.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 3fda00a0f786..2ef9db0189ca 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -130,24 +130,21 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *folio_sz) accessed = false; else accessed = true; - folio_put(folio); goto out; } need_lock = !folio_test_anon(folio) || folio_test_ksm(folio); - if (need_lock && !folio_trylock(folio)) { - folio_put(folio); - return false; - } + if (need_lock && !folio_trylock(folio)) + goto out; rmap_walk(folio, &rwc); if (need_lock) folio_unlock(folio); - folio_put(folio); -out: *folio_sz = folio_size(folio); +out: + folio_put(folio); return accessed; } From patchwork Fri Mar 3 08:43:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13158396 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 DFECBC64EC4 for ; Fri, 3 Mar 2023 08:23:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20BCF6B0073; Fri, 3 Mar 2023 03:23:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 185086B0078; Fri, 3 Mar 2023 03:23:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0238A6B0075; Fri, 3 Mar 2023 03:22:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E97B36B0073 for ; Fri, 3 Mar 2023 03:22:59 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BB4A5C083F for ; Fri, 3 Mar 2023 08:22:59 +0000 (UTC) X-FDA: 80526896478.08.64C2644 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf29.hostedemail.com (Postfix) with ESMTP id 65E8612000D for ; Fri, 3 Mar 2023 08:22:56 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.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=1677831778; 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=nT8uAvYOgS1FhzPAq4yJd4zNvTr6g7LkLszlvw17IDM=; b=V9SVjt/Agz4tsqjZHkL4FQT1hAhRbUuN2kfXRt1GBLdtjArz7YEVxG4OP56bfV+SwsSa+J 2JeIrjPjtiDI64Ubo4W9XF32c6fZYNTXUTJ4n5h3eRhV8IeRnFptQ1dJTjV6zdz052f7cb VuYpz1oMErqRC7aQaopwRrpQNMCZeSQ= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.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=1677831778; a=rsa-sha256; cv=none; b=Sot75ucWApCgo3LRXxIEYQMCrNw3bXiuW7vxBwx/9iwcY3CClveMBiYotIwPbK8DtW0c0Z MXbycEXMgkq03eJyh3tMyP7K1NDflKvoFFxcFLJ+8yWitzBCVq/7a5al1I5FmraIrytNig CYsXe+inEqC3n0quTLuswid208vkW5E= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PSgsH2VDwz9tKp; 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:47 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH v2 3/3] mm/damon/paddr: minor refactor of damon_pa_mark_accessed_or_deactivate() Date: Fri, 3 Mar 2023 16:43:43 +0800 Message-ID: <20230303084343.171958-4-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: fmt8t1phkj83dop3igdawb3ozwts1awr X-Rspam-User: X-Rspamd-Queue-Id: 65E8612000D X-Rspamd-Server: rspam06 X-HE-Tag: 1677831776-365036 X-HE-Meta: U2FsdGVkX189wNecCyKBuP5tBfh5Pk3jNpiNH0WpcOO3kWihxdlH4GcZL5yEl9MaW/Vk6ko8qOMxCdqPMrf6Ua5U4epbYhXhS/mKYNteLY2WZR5RaXrFQTSFKCXabAA6VPm4ShyJQxb1ua+wx/7AVt2A9lc+7w91PyS8QUX6g6R1qz7jz5s+9z/ARdJoh10DFY6vt35SAnrmkFNy0T57Q+HLLU3LPoMaSsXPRW49gIXpPQhRk6MrJklWGI9IbXTSZJuB2+4Z74n4BJ34FOIgpCfeu9ID9EDCyixprGdh0F6de1yDTu3B+DGmzoFBRdzwcKwr8uvKaJzwu650rXLCX1XzoslsAtQHH4sQcdsRfpWQsjTC3cNpRFFOFra1fLBpExGphTmVBYtTX5PHJHcmixWetG8Px/HBgbtRU9Y9Hol632h9IZPbe3Ww0rf1S5q/ffI4ySVvWHLMREYk+6vpkUhnVEgtMOyDDixdMSbEeAayKQ4F9baaHGilPjD/yBf5DDMKMtp714n+Aejcsr3ilL7ZzuYMUsUHYOZIXQ6DA3UBnq13daRcP7IA1KKBsYMTlzV9W0xSmWBL7Dd0SihC3VT19lGNfBEg3vnyRIN3r0PX80lFfSpQYwCeenFD6/ow96Ndfk4YxwjtZOOWYGoPgE2yxFMJmFkSFjmsLtqH8aJdF1iiDmF4DUzskNTXogeRL8fLEM4aCO4o5MGywLP8kGKOQRr1Yjo3uiUjH1FG072cy68VlNsBayDEb97UHRV+C1VVwMAMF0B4p8eYchOJGIw34JmOO6ZlWqVHRpXq3IKQ7cTO4b7wlQ1YYE1kZkNxzgBb5Hx5X40qwyW+5FyCY5ekQyvRIX9KCsrbmzBjC6N7P5bQwB+A9+5gXh5BT9bTBmdkwo4P3BFYStsprAmAONcFa2adR9YOcjeK1EVak9hft4NjZWEtYDtTyVm5ZJyg4T1TOp9RjB/UVq0YSmY fiWgeuBD IbwxvqLEgmEmLM0826B0QLmoS6PW99ultawGW958GNPNaT4bjBJI2Pa1SpFWH1pGTdye3ZQu+iZam9vHuQspWd/94hGgC2v+X8khTT+11RJ/AefCEAKS9zDl4BBsFe2nIeV7899fTw6bGdd9beqmdRTZMMqgVvB/ugmsGnozX4nJnF42e2udXILoIvITecOcPhC/Ff0zoWprh3mK+JuN7bVmEpw== 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 one line by unified folio_put(), and make code more clear. Signed-off-by: Kefeng Wang --- mm/damon/paddr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 2ef9db0189ca..6930ebf3667c 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -266,17 +266,16 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( if (!folio) continue; - if (damos_pa_filter_out(s, folio)) { - folio_put(folio); - continue; - } + if (damos_pa_filter_out(s, folio)) + goto put_folio; if (mark_accessed) folio_mark_accessed(folio); else folio_deactivate(folio); - folio_put(folio); applied += folio_nr_pages(folio); +put_folio: + folio_put(folio); } return applied * PAGE_SIZE; }