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; }