From patchwork Thu Mar 2 14:49:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 63431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4265754wrd; Thu, 2 Mar 2023 06:34:55 -0800 (PST) X-Google-Smtp-Source: AK7set9KAAn/MsFjnwdZuwid2PDU4GqhU88IRzK8VCPkSVL0km3cTuuiOfsUe+GYzV5vozbcYCDx X-Received: by 2002:aa7:cc0e:0:b0:4af:5ff1:8756 with SMTP id q14-20020aa7cc0e000000b004af5ff18756mr10621431edt.0.1677767695211; Thu, 02 Mar 2023 06:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677767695; cv=none; d=google.com; s=arc-20160816; b=Bkf0I9XUCrTPGm4nJY3xMqxmA9grnLDo4qpjLe16ql+ZdB9lw8V6HtjUQ8zTpMWfIS DyKtpq76otXDGDI44AwWsg94Zv3xc9zAKD9KYIumgkO+M11Od2RZ46XdrhvWdzqut799 P1D/XsDusH3RHeNhaK2wYBEAb2bMZpSWzXkU3upBKj7cMz3FguhfyyqNMI3wUHA0yVe3 lV3GnGthtc2L5NdOfTO/EnhGMWCvEuxHxQ0Uciu7+WKwpFahvXFETwVS19dXs4A0BNUa vkgR1hlafqxiLVciGo1idjmxndPZx2mJ68/Jn4E5E2d7bEg1HnCZwFaQvNk+VDzpywlE wodQ== 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 :message-id:date:subject:cc:to:from; bh=Z2VtlejJQUVI6btVxDqpwb24r7VVC9zOmonVzo8yC2E=; b=Zu3FLqyf+vnOma4g7jlk45G4WPrStzAwcrhGM88pLda6tv8rmUP8G67RiB8ZQqR/FJ koHTtEUCxMJ4QNcQJRZEcOe8y82bxPpNAOswty9JNvODRvtSNdzgsc6/D9KI5a1SCPYX V1yvQLL1mpbWsTcDofE0xJK/Qm99lvRb7njcnlvEYtPw6FP/+Wj2KtIP813pbpaSBKi9 vSCl+IF5s1lGYDLxRlVRPcAsWqXrb1iFz5wqxbIzTJkA0mNv73N+ZjVtBOiagU8I5lHI iKDkICPNbvybIKHQPFYExN4Cutruxq6n3/I6iXcUhnQN/ayIUsOUCRBh8J0eU5jtOjmy Gu4A== 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 n2-20020a170906118200b008cc4457c734si9891058eja.783.2023.03.02.06.34.32; Thu, 02 Mar 2023 06:34:55 -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 S229780AbjCBO3S (ORCPT + 99 others); Thu, 2 Mar 2023 09:29:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229807AbjCBO3Q (ORCPT ); Thu, 2 Mar 2023 09:29:16 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE0D119698 for ; Thu, 2 Mar 2023 06:29:07 -0800 (PST) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PSCyq3R4pzKmK3; Thu, 2 Mar 2023 22:24:03 +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; Thu, 2 Mar 2023 22:29:03 +0800 From: Kefeng Wang To: SeongJae Park , Andrew Morton CC: , , , Kefeng Wang Subject: [PATCH -next] mm/damon/paddr: minor refactor of damon_pa_pageout() Date: Thu, 2 Mar 2023 22:49:26 +0800 Message-ID: <20230302144926.40012-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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?1759266938524612890?= X-GMAIL-MSGID: =?utf-8?q?1759266938524612890?= Omit two lines by converting if(!folio_isolate_lru()) to if(folio_isolate_lru()). Signed-off-by: Kefeng Wang --- mm/damon/paddr.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 6c655d9b5639..a557f3c9300f 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -246,14 +246,12 @@ static unsigned long damon_pa_pageout(struct damon_region *r, struct damos *s) folio_clear_referenced(folio); folio_test_clear_young(folio); - if (!folio_isolate_lru(folio)) { - folio_put(folio); - continue; + if (folio_isolate_lru(folio)) { + if (folio_test_unevictable(folio)) + folio_putback_lru(folio); + else + list_add(&folio->lru, &folio_list); } - if (folio_test_unevictable(folio)) - folio_putback_lru(folio); - else - list_add(&folio->lru, &folio_list); folio_put(folio); } applied = reclaim_pages(&folio_list);