From patchwork Wed Mar 8 08:33:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13165368 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 76288C6FD1E for ; Wed, 8 Mar 2023 08:13:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C5A46B0075; Wed, 8 Mar 2023 03:12:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0762D280001; Wed, 8 Mar 2023 03:12:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0B106B007D; Wed, 8 Mar 2023 03:12:58 -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 C6ECF6B0075 for ; Wed, 8 Mar 2023 03:12:58 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A124EC0658 for ; Wed, 8 Mar 2023 08:12:58 +0000 (UTC) X-FDA: 80545015236.26.90D80A9 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf28.hostedemail.com (Postfix) with ESMTP id 719E0C0009 for ; Wed, 8 Mar 2023 08:12:56 +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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678263176; a=rsa-sha256; cv=none; b=eSnLkYBeM6iId5E4ZT/nsqZ/ozQIkUwntSms0PwUT94fFlKZIQwBbQfByRcMds//9OkJQ2 tG1lIhfczJDGpyxJcKLotL36NuSF7/SK3HRd7fIJbtAYG7oYbk2Tt3jcvXnMhiVndwSFTt 4JNN3mRjYv0ZHl/xQDvreBCoSvQIZ9E= 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678263176; 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=rxxvt2ZY/2w1vBgoz+ZTt/7u5whq/ogITHKZHoaklEA=; b=AaymGP/NLFTEWqHCKSXc9IuZZfE0aJZ4RVPRhBRsEnxRZ74k7vcrUloCJJMnVXrQKUyrQk IwInZsF1ElawRWK12YoJ3JydXcUaXQ1fnbONB4zjj8aeXTNo49WJndo6/iw6h4xCBeWGgw 93tkdoH6C7V3kpGdKPhbCPbapvLOpZk= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PWlPG1NkyzKqJm; Wed, 8 Mar 2023 16:10:42 +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 2/3] mm/damon/paddr: minor refactor of damon_pa_mark_accessed_or_deactivate() Date: Wed, 8 Mar 2023 16:33:10 +0800 Message-ID: <20230308083311.120951-3-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-Queue-Id: 719E0C0009 X-Rspamd-Server: rspam01 X-Stat-Signature: qwwjc4emodw1xfon5uq8r5t41dznpkm9 X-HE-Tag: 1678263176-32213 X-HE-Meta: U2FsdGVkX19SBug4CaiP4OHZ0yCfflcJjDuLfhdYdA9IM1nVsdf5WMuIJe30XVG0dWT2NRfV8PYh/oEBHZ/KHftkJfJwnfv2xEZDPTGp6aWOx+MwwJbgBYG105vyrSd61aYuocOgt0CBUj88JODsxt1bXRYEA1gPA5IASTxb4ixEeGZPxQSAG1/1L6v/TYIOMc+OgtTDVC+Rx8BT0jdq7Fp4WLIyY3AB3rU7hH3zvsRhn9FXKiX3yQgobR8dlg/04NYrS+FnZ06y+z4Z7cFzYKmN96odsBeCKkfhen17sSDrBzuoitWhFWwrTE+F1RC4XI6A5hMN5f7r5lFVQfqlXiOP/QTibGSLG/gVHSEBMXMH+OQQiGtXJsdziSzH/Xmo5YKCudzLs+1J7ZubbnBmAEwQsmTN1zVFgKVqioBvz3rT8crJ86+g6qbS7634LEsiQ+wnXGVUDvxlfIM7EhlMWcAcKN7kdpS0cxRwQH8HAMFxgk20UVhD1ePI9lkC5nUptRnRmRxZUIwt1/5oQyRP4dqS83qn4IGmsBmWluR+jePkzI6VircYLVY+E3xuJeW2JzbndIdIqW2tHH4cPPeT++qo+UHFeEhAiYEff6fdZsyUrweABiuxc7vA4gxxSf50WMmCq3PHG/nC4Qc6zfqwm3uWYzg4lBJRplemvQD2HPjU83/ipvKFJjVF3Git7Oqs4P27oi5zofmIVxSuh2ABcF1m7kFUXvajDHwZthZQUDqIHUGYczYBxWPUz2wgsfT5zadEVtHOpKxc6Z1qsGONvje/R2k0I54KYcamXsTxNFNmO85EyLsqUMdCE9W5YzU/DipZxrfeD4Un6iA3Vh1lHmYs8IS7rsgdAAm6eX79s8H9j+G09AKGCOTbv1ujI+1g+EYHXSaTC/W049OecHa+k1YDG+lrjlln+tfDxupK+mZDmrqwfy2bR+4Ox/V/2jbpDq6YyE1P/cTl+iMvCMc NvuHQRPU TftJsed0j/Mmp9ujSsSHzD4CYZHZwDSVQBGUB6bs4n0HlDhm7vkeZ/lvaPq+j6t+aZ/SS5QH86p7io5UbPJF9+UY8a5wB4Tbw2Deek0Zv/oYJNv+crfhBcOv8AjYoGVHjc4UHHNg0nCX25ildOmovVL4Mu5X3O3f1oKkokCy7a1n/Zz3decsS0lTOuXFTdMu9cGCJYEyJYOBSJmkjUdjTuLS9rg== 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 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 0db724aec5cb..b22f6fbb5816 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -268,16 +268,15 @@ 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); applied += folio_nr_pages(folio); +put_folio: folio_put(folio); } return applied * PAGE_SIZE;