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: 66071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp205681wrd; Wed, 8 Mar 2023 00:21:01 -0800 (PST) X-Google-Smtp-Source: AK7set9agAael6OeoIwzM2EHWH/gExyFYLjQbbu7tHZGTWX7d6E4S4a54kyMlZqQAmhriR97BVxu X-Received: by 2002:a17:902:c94c:b0:19b:33c0:4091 with SMTP id i12-20020a170902c94c00b0019b33c04091mr22858280pla.52.1678263661203; Wed, 08 Mar 2023 00:21:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678263661; cv=none; d=google.com; s=arc-20160816; b=o7Ms+8+DB3GDTdXfHwjJUFDzfiNth8Etn6kZ/N1IOxQN7l7tcIG/zKFLvYlkg0pmjD JMNuAA+HdtXG8BKDC64PZviFWlrIlYwLF5L83pla3l+Sjf4C+lacguF0oZD8a/OG+FI9 mOUeIETFkCCdZJ/6XFRB90IqtqhNz6IwrHvEgUcENN+fdGAHJnjrmV78oTuYi6PIO5d8 huMG45YSj/JY5S2XVQqFypFfJrC2pZCvNwi1vE9p7pYRQH/K2Q/3Ymz4hyOl2sGAXVpR 5Fb5VSNV+UbN5xU/lQ9xmRALCZ1XThlycMaHFXkHBVgK1S7R5IVxYvLB9kuzJmSRuAYP VIsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rxxvt2ZY/2w1vBgoz+ZTt/7u5whq/ogITHKZHoaklEA=; b=YKQmWXj36qkM0y8oUMZ9uFOv6kM43+TzDQtn0LtCG9fUff/W5D9I76+zY8K5PHddpp hikBCeA8JRo7TZt9+I9/HMkZd0r9PVeBnQipuiEDBJY2EKGb794uf+MoZCBBz74/YI1u 4ePp9XKeXKgMT1t40Ld89KXOrI+VwlXKTsdZWtrm7ZmgLOYgeGASBDo8LObksK/mToGy Ks6+Zz2qqyf2pYZ32d16z6jg0iDMM+7uDWy1mg44gYwGRNCYx8yldSePyne7mqHTwzqv rx6qcS5AJ4ViV1Us/y8GAr1ecDuqNSFv2dd43hwR80dks1PYCTvI5HeaO1xgJRBKoVnp mAEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a2-20020a1709027d8200b0019ca5ddf234si13708577plm.627.2023.03.08.00.20.48; Wed, 08 Mar 2023 00:21:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbjCHINH (ORCPT + 99 others); Wed, 8 Mar 2023 03:13:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbjCHIM4 (ORCPT ); Wed, 8 Mar 2023 03:12:56 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1F5DA0B28 for ; Wed, 8 Mar 2023 00:12:48 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759786996980439438?= X-GMAIL-MSGID: =?utf-8?q?1759786996980439438?= 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;