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: 66067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp204747wrd; Wed, 8 Mar 2023 00:18:07 -0800 (PST) X-Google-Smtp-Source: AK7set9JaZsUiYuG10b9jMfo0dbffeAHvF/K2XIbzUWCJYxbWswCeaT9Ml8XyPHhY6GzZHhZZTRh X-Received: by 2002:a05:6a20:4b09:b0:b0:c30:1de with SMTP id fp9-20020a056a204b0900b000b00c3001demr12330118pzb.61.1678263487633; Wed, 08 Mar 2023 00:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678263487; cv=none; d=google.com; s=arc-20160816; b=n7tpiQIWUXrtd54NjNVaz885RgCRxKczlJlA7OFoH2oPySxvuNM+bIqHypPE/9SOGT w0BbCjJgjfuDu19ffrWJXbDrInPgl9dqH2Y+FbI6k327rfcDAPUXzP60N3wqQQlXkhIU I5ak14g4V2tVsENX+wec2Um8eTG9A4mbYkCBY3L9rRnTX8K/Z9d1oLvKSRmvLhvCbBfM /YNX75/gh/p1zQzUPrp2teWxpT2Dqzp2up2mFZOJxe6TCXkTU/1MXBv43xkky0V/1SwY pKABGUl1VNDmoLj8GdW7xeqoNInj7RCc/Dsn9r3BrDVVrlPxIrjxGmy4Gu72bWms66cP BU9A== 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=+Layu/iSxbaCwl2EtiPPzTOBELCa4Jr3rf2UxbUwrao=; b=f7jfB3UUbsmyHviFmbHQRw8Q0JnE5wJQrGuY6ejYvmODweESSIXZwP2tPzPF3kxap4 YtBBoN1Xhn8wPXDZlzkQbrnKVAx5D5wFO6qg2h1fcIuiZondZSxP+M/Vk+4DHtxzYFEj bWdmk3LTjbniXrtQA1bgDxpm7b5QNSboo7qSGF61pnuw8RBwb5DI32K9RdvKla2KkrPi FZlaHAmIecb1LhbWIgrldUBLxQ7ZgcFGvq0n6rABH/IpYgw3OQpC7M3pUVgMLUG19Ez3 0A67JUbPbUrgOAhgHz9w/gR/rYEgidB90hv+bGMmPQDvktTnxPP8TDv60U7KDSKY/tKO rydg== 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 j62-20020a638041000000b0050780e28ce1si764275pgd.701.2023.03.08.00.17.54; Wed, 08 Mar 2023 00:18:07 -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 S230051AbjCHINM (ORCPT + 99 others); Wed, 8 Mar 2023 03:13:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230031AbjCHIM4 (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 C0E41A0B12 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 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-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?1759786815174909344?= X-GMAIL-MSGID: =?utf-8?q?1759786815174909344?= 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);