From patchwork Wed Mar 8 08:33:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13165366 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 C0F95C64EC4 for ; Wed, 8 Mar 2023 08:12:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9015E6B0074; Wed, 8 Mar 2023 03:12:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D8446B0072; Wed, 8 Mar 2023 03:12:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6405C6B0075; Wed, 8 Mar 2023 03:12:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5175F6B0074 for ; Wed, 8 Mar 2023 03:12:56 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 21E181207F3 for ; Wed, 8 Mar 2023 08:12:56 +0000 (UTC) X-FDA: 80545015152.15.273980E Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf25.hostedemail.com (Postfix) with ESMTP id 4EE35A000E for ; Wed, 8 Mar 2023 08:12:52 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.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=1678263174; 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=+Layu/iSxbaCwl2EtiPPzTOBELCa4Jr3rf2UxbUwrao=; b=7M6/1bI2g7wMyb4YgZSocnvXfNBvR8VrhtHHdH5LLb/2+/8D5GWrc20j/DHiOZRCOiQZWS 01yskw0cc8irKNWRE5PpHJDSIx8UkBHis+5RkD2wkdldUfxhhCsHBwlx9Ju73wOwU2gnlI qFlw+5sJcnnz6Pl4TXpAYl8jLxglPFI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.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=1678263174; a=rsa-sha256; cv=none; b=MC3nWFuQSKA8rH4C8n58kmZttp0hCrs7Owzf2Gtrk1yAUhWjLGqszDbehMxUHPjD1cNORz AVAevSGFb/j0On6BC2SnbLQYAS9t+Ba78Uz7PGXHygH508DTsliPx4Q08NrFIQzTaNg/Nj QZwCSquqYfkYgjW9RiephtCJMMHQeoM= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PWlPF3z9pzKqMt; Wed, 8 Mar 2023 16:10:41 +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; Wed, 8 Mar 2023 16:12:29 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH v3 1/3] mm/damon/paddr: minor refactor of damon_pa_pageout() Date: Wed, 8 Mar 2023 16:33:09 +0800 Message-ID: <20230308083311.120951-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230308083311.120951-1-wangkefeng.wang@huawei.com> References: <20230308083311.120951-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: fmduahsf7e6x6yxh9o8z8cgknrso6kfc X-Rspamd-Queue-Id: 4EE35A000E X-HE-Tag: 1678263172-48797 X-HE-Meta: U2FsdGVkX19N2yuW8PozNRkxlskhwA4+yxIlHtybElCZJe8MkwzBwGx6msyWja0CAxOTvOGOM+wcZ+L00ZXGK8mQ6IwfcaEdfa8/TcRgIZX/Ao2YLOLTtw+n/xm+BZ7WMNiaPsWgVmGng+mPFg9WroOgZG4MJutiyYJKc2CyKTkt+M7DS0/W8twhlLlXuap06dRgoPXV7JJ0JwquH5+5Lb7Kwkkt3Rzp4V2ZmVHYWMyn5H+WvrfyQW9QYpgD1OfKgj4agMGX5uo/LF4oE/2wRBW1YFrtjVHkki1zXduzSHwgkQvxJWex5CBzUaWq3bdqD6nGo63CSezRkMw1aRXFWG6qJCooWmOO5RaytPfJ+Mq40v2kBTsrRaCCynXTKJVyBXVAqXDZqNqLMVMtrb0Bu57ZLOx9wlndwNmjWEekyFHrrm7vKU+jNn3aEXc8udppQfm83tDlIQ1F1wyfwcaX52s9tXv+aP8xeITyYrI1xcmPAkUcGPLBdCRahCli5AiZoUVUGAYAwwT754sFSYRAa4U9Bav7T7AV0heu0YKE4I00Q2ielpskg7HPLCRvWgEbzmWIVcdFvqK1PTAC8EsNoQEIb2oStbGiv8aq0OVE1YiNsg5uja+05yLGuKWmxukLmcHOzpLK/bo00uVkreSwq+MdHCCBh5nSzBnNgDprfee9SzTMskabPrDaMWXzJeWxxwAsDVHddWkOlcAPfBXVntMia4stmq/RE4QwqsGxLw8zuPCjUQ/uPOfE5g7tltxfal2DLtZ3XamQ9Qau8Q52WTAs8TlZAu00D+dZdxJWU45vZ+8Y4Ov5StpZvJ7zeUqX0Ao5uK7NLE//vwizwaOjp0kJ5wzzuW7V0VX7Mq2laAKJ75TEPJ+7ooslSW365mK40vv/llK0HHZK4raQGnDzKQligVSY8PIuD1HH5HDSjbiPsMT4hb0xAwBka1qvZMJO2+LL0LTO2MKlzO3w52z BoSUgxyg bmxw7TM7FPv/HKTTOl2bdMQCYB2IlK2jtwrn+Uc2Nn55JtoeDWvJd2p06kKMN2LeAifKaqiZAgTzumKwmfHl8aPm+sVPnLo5juOLqVlKbHr2EHJVtDcepRxV7wG9MeONZLRBYlL80KJ3R+A0vyFGX6VXpmePvcYnGk/ZKNU/9apOW8uNI2c2CLAFJwJs5JMDOaEXeXbVxC+WM8+fYz2ZCDAIXdNva9MHXu2ZX4SjR75xOZGKj/6HsGUE9E72CiYWbIzjxoycQVQf1wyA= 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. Reviewed-by: SeongJae Park Signed-off-by: Kefeng Wang --- 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 dd9c33fbe805..0db724aec5cb 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -238,21 +238,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);