From patchwork Fri Mar 3 08:43:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 63785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp292936wrd; Fri, 3 Mar 2023 00:33:19 -0800 (PST) X-Google-Smtp-Source: AK7set8NtbUM4t1wIoEFBOIPaGpvQICHabV9J7zwl6DGOBOLHH4qMZUWXYsMa/1od5wxQyYz2nFI X-Received: by 2002:a17:906:40d7:b0:871:d59d:4f54 with SMTP id a23-20020a17090640d700b00871d59d4f54mr827536ejk.27.1677832399220; Fri, 03 Mar 2023 00:33:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677832399; cv=none; d=google.com; s=arc-20160816; b=b+PF0XIzd+fcVq4V8/gBBsbOIxhbPg8JIYAzUSulBCXBIedhhrJblNwmR0CyFymuRN tb81RiieS3vNugn8gjEgRIAozotjiV8BenA0GnnXdPOe7X4j7Ejajne5C6RzG1XslFgV 9UocEBqd4IDDarRsftNYQVsT2JEqRDWroNoB7cxxq4zYmkV/N/5wQloB05Zc/wYL/nVV yWzmWDpfBweCsEbdWr00szczucRQMj5FiCsyR6zUVkH2yR1HWOVO6jAAgzx74ERH/Z6A L64tQaEBLysUou3MSNImscarJuxfPDhjrv2VBjBncNBdA6iQ3JQamnVpZzCsjXw3Mowe xuow== 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=y1434TH914/XkXlPb4/bO9w69xsgM/XMN6HmD7zOhzg=; b=aqPfNx2KXUgDZ+WT8BjhjZqbkIl3hfvfzowPVQzbsdn2bbm2iMA0uARmjhDc6DQrH5 GrdxoyLbMsQB05K0l6NMGNIW15AqlLq4zwrtqHQJxb/GqpoAbta+afOtJU4XlAj5/z4D WcELbaPmlXvZt7aSROQ3d/f53I5DveFw3EdkJE5g7+1VW2qboCPUYa06mj9qNGuekx1T gK87ksNOqQtPYysAudwVbnomiv/1RO9IRfMEwyDyxFmyXrpRf8LvREwCskQ7xOyRp+Oe +kmFw/Hp1WgXI3EoLgWY/wSprRXP9lFs5S9rUjQnBedH5q0MHcMTUILWR6Q//HPIh2Qj YEjw== 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 m6-20020aa7c486000000b004acd42c5911si1984931edq.241.2023.03.03.00.32.56; Fri, 03 Mar 2023 00:33:19 -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 S230085AbjCCIZD (ORCPT + 99 others); Fri, 3 Mar 2023 03:25:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjCCIZC (ORCPT ); Fri, 3 Mar 2023 03:25:02 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D89CB158A1 for ; Fri, 3 Mar 2023 00:23:32 -0800 (PST) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PSgsH0XMrz9tJH; 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:46 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH v2 1/3] mm/damon/paddr: minor refactor of damon_pa_pageout() Date: Fri, 3 Mar 2023 16:43:41 +0800 Message-ID: <20230303084343.171958-2-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-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?1759334785500130619?= X-GMAIL-MSGID: =?utf-8?q?1759334785500130619?= Omit three lines by unified folio_put(), and make code more clear. Signed-off-by: Kefeng Wang Reviewed-by: SeongJae Park --- 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 6c655d9b5639..3fda00a0f786 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -239,21 +239,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);