From patchwork Tue Sep 19 09:52:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huan Yang X-Patchwork-Id: 13391075 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 152BCCD54AB for ; Tue, 19 Sep 2023 09:53:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BD566B04E9; Tue, 19 Sep 2023 05:53:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76C136B04EA; Tue, 19 Sep 2023 05:53:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 634E96B04EB; Tue, 19 Sep 2023 05:53:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 541156B04E9 for ; Tue, 19 Sep 2023 05:53:15 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 97669140B9A for ; Tue, 19 Sep 2023 09:53:14 +0000 (UTC) X-FDA: 81252883908.07.2545D60 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2126.outbound.protection.outlook.com [40.107.255.126]) by imf14.hostedemail.com (Postfix) with ESMTP id 6AC7B100034 for ; Tue, 19 Sep 2023 09:53:10 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b="cj1/5SF5"; dmarc=pass (policy=quarantine) header.from=vivo.com; spf=pass (imf14.hostedemail.com: domain of link@vivo.com designates 40.107.255.126 as permitted sender) smtp.mailfrom=link@vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695117191; 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: references:dkim-signature; bh=0ALlgzzumrsJfztPGkWD4xJtPV8fLQKJHFgAMHE5RsY=; b=FRdov03oyPP+Qk+PH4wz9AaqKcGEh5mjlomJq0+90zF26wNWnWu5XSVd8kRuy6QCbf3/Zj izrRM94Zp9OmXZutc64V5GWrQ45n351iK2IEOpcOH486HDMRi0BIhfrFcsDrfD+ElBVJ6B we7xGUCv54xJJWB0lA+LhhSs/RYZO4Q= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b="cj1/5SF5"; dmarc=pass (policy=quarantine) header.from=vivo.com; spf=pass (imf14.hostedemail.com: domain of link@vivo.com designates 40.107.255.126 as permitted sender) smtp.mailfrom=link@vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1695117191; a=rsa-sha256; cv=pass; b=SyVRsocsLOPBd9EMuHEhQlPyU8jYXMUru14ZXNHcchRJc81u2lTzFHVinC9t1sUMIVM7l7 D4hnxEHwCz42BCgoRYC+4wtjw5QkIcG7LdBFXUOkm/DW+/4qq7z1T31K+X8Ywsc6XJ/Hxs KVGnXQotV9KnmX3cKzErFdDE5PoZhGI= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R2WI5qhIlOHlK2ksSspjZm7bDIRkxx2EkT2L3cv8bn8AFvcQnDKMuIPRPyFFa/Uq2jUXWg3TvkMFSTmtfccqiOu0qSc1IdvftYKRBT1060E0c9gCDb100vSlGA1Cvj2LS5eu4gI5AYnkicrqSdhhr6xfZJ028H8mYgzV5tCxfbQ/VZu52gQ8acUAsKMJET8DWY1tN+dBgdfooSbkLiOnSjU0yUsA1vOPrgK2XBfFIE3shLpKDIZ3UzPhh9wqbTqV7w5DKD1IogUxx8qopJXxc/xMq6q5AQfvuk2QU6rSkDH6s0232Z3YjYC59kxAZOgfz6POd6LR7RySbRXXzr0DbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0ALlgzzumrsJfztPGkWD4xJtPV8fLQKJHFgAMHE5RsY=; b=eBDWLESPR5wN70UFpGnRM3oV6dqTZ8dqMHhyeSogR1rFDMqcmAKzJ6R4aUmu9ZCn/SEzsoVJ6Si+w1WYUiuM0Vke/VY6BKME6aLjgywRsHDvVUr3/JnpssYafyR4rDgLVga/9ZhHT8hC3kqDQYeYz5aCKHReAwZEMFQY3Y7E9t1BSKSPdEwZ0ROj3iAfeHkWp2k/HIuQMBkc/tdxYKGJZM3Dudheho4Zt6fZIyeInFFbZXdcTjXI+16v7z6BM4JoS+TRIvRO7sKTCDCY+7hm6d7dDI55bORTxlCdY+nbw6XmkXUO/pAXGhDVzVAihyNgxcs49Nke7zxfn7O0fDLK0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0ALlgzzumrsJfztPGkWD4xJtPV8fLQKJHFgAMHE5RsY=; b=cj1/5SF5ylEwInA2SiG1HAJz7JZAThSyg/wuVOeAciO87diYhm6n6+Q92Us6MSHYRpMLgAc5f7E/V1HFsBaxfFEF8hnlOOjb/Kwo6I93MOB6a38Zt6I+OLi/VnwWyUe3vKGuC4IRJIedr1LrGE0Fh2u0UUBpXxpir8FZWySrgQr36wb1N3waPZQePhzV8LQGzVrMMZj9G/JKEibKJVzuPVyRmbKoi/+8uaaEZWTG0Yt9BLsH4m0ji7UKB8GePXBg+dQXzy3Irog+ZJb2dVVb+Luf1Ee3vOhGfjcfRvp94P/okIEG1+EiupTx+VeftamfqU8UBi/x2x+CDxXXncCoxA== Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by SEYPR06MB6982.apcprd06.prod.outlook.com (2603:1096:101:1e2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Tue, 19 Sep 2023 09:53:04 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::64c1:bd7f:ced7:7d02]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::64c1:bd7f:ced7:7d02%4]) with mapi id 15.20.6792.020; Tue, 19 Sep 2023 09:53:04 +0000 From: Huan Yang To: SeongJae Park , Andrew Morton , linux-kernel@vger.kernel.org (open list), damon@lists.linux.dev (open list:DATA ACCESS MONITOR), linux-mm@kvack.org (open list:DATA ACCESS MONITOR) Cc: opensource.kernel@vivo.com, Huan Yang Subject: [RFC 0/2] Damos filter cleanup code and implement workingset Date: Tue, 19 Sep 2023 17:52:33 +0800 Message-Id: <20230919095237.26613-1-link@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP286CA0003.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::10) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|SEYPR06MB6982:EE_ X-MS-Office365-Filtering-Correlation-Id: 4445225e-4bec-43ab-d3bc-08dbb8f6380d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7ZQ7AuzLmA6fKbcsti7Z3kW4EjOWkSJn240CXOqHC19cyJbdc3Wcq6DtN0Wk0htjF70PhI0cDLhhEYiz1mmtSB4KwFA1ygdRiXiJoIywDqnwYsZQsWKyR7THEM20322dW3TOsMz6oJvAc0mVhBgIWQY09/hvU9mpI2i532ad/q2jVccAKmBYhQwbuHKjoXGiQ3PGzLDaFt9wiPgheuYvzjUc1zZuMK40shp/eKUt8PumawkBdq0+h99Lsn0J9EKAw0np4E5hrE0zBkex/w3z7u9vNf9K7JbVBiJIK4wg0ZFmNTo7Qh2kK3RUzkPzYRcGqy6xLeZ/8HxoQU+ZGIVRqtvSoAb7qHXxwax8AW6AzFbPA2W/D2mwhViYkfoHExLBrxA+smFC3HBrKAq94YBrZ+Oz7NxrH2h0PYyZx13BZjFz4KQ3sw5s5Az9u3uGtPv+Z2E7eVGfVMGVcGLwF96fZisRMiIEvMP0hpAUGsXk4Gc/o2pKXGN6s9VmQld+W7daI2NEg1bbNmZEEvR+62jCQt5qUIiYttVBMtdnSL/vvmdqqwjkoVEEixZrvjqPCsphZq7HR0/6jpJii03djZNjvnwArjJ17Ma4swR5SGJK4UQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(346002)(136003)(366004)(39860400002)(396003)(186009)(1800799009)(451199024)(4326008)(5660300002)(6506007)(6486002)(52116002)(8676002)(8936002)(316002)(41300700001)(66946007)(66556008)(478600001)(66476007)(6666004)(2906002)(110136005)(6512007)(83380400001)(1076003)(26005)(107886003)(2616005)(38100700002)(36756003)(38350700002)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9jLvyEy5vwBVu64xIi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We2DQKLegHdS110NWn6Y6Yq5C6Tn+8dUXtjhlslRK7tbQaFt3tlnqKsnMb2D2kYl4bdL6FhAWHTTabIRCUIE5n6/ahx92GpyLhGOW2fWGDl53VEPiSwPbC0TeAfei7txERHlnNuK7382SaB4s1LmYSNNTgCmxljP9SR+H1u8QsJbtEQUUhu9+0bvJHqmXPRWBF3BGVS9U/R/B02vE4PDfGVwPy4VUh9dPK+rQ/+jTsuFibIZVdroeJeEBcyll2UVH2a2hC5ZoA6b4eKvlYTxnuTx29d4303nILWUa3zBKlWdwys2vwtEluFCswx3rCGZmeTwEt3wu7clNR13QxdzAGsXsO94x4BQiTZ5iz11DwMR4KyeD+tD2AxibpAybK377K+gpv+TUxJ+7DWfFXAFbKcXRFCpY2wLIen6oFsYQMUHjl8EIx3donteLZgSd8iF+psiHNFdYWVu4wALDCFkHEmWl8jlorpcmU5mr/Itgz3Ua5onceT0694n X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4445225e-4bec-43ab-d3bc-08dbb8f6380d X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 09:53:04.6576 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tuc8bGPFoIYhUzRWHGAc1FN3lNUzA2zAAIWCGDDjPdxxuWhKJiR636BoSs8B/57zqOmm2NyAQjTBIEd+4BeDuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6982 X-Rspamd-Queue-Id: 6AC7B100034 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: csc9gu3f6n5ckkkq8gdf3yj5no96m9zr X-HE-Tag: 1695117190-564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qBDkGputuwfnA/e5a1dkKgQAoxjSsbS1wm9kdgiq2VsvxjLr2/NjxKotR//LH8iAC7IN+rCy0qPaELo+uhGWocL90cgHYv6eUIB4ex9IT/kHpO3edatA X-Bogosity: Ham, tests=bogofilter, spamicity=0.020610, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Now damos support filter contains two type. The first is scheme filter which will invoke each scheme apply, second is scheme action filter, which will filter out unwanted action. But this implement is scattered in different implementations and hard to reuse or extend. This patchset clean up those filter code, move into filter.c and add header to expose filter func.(patch 2) And add a new filter "workingset" to protect workingset page. Do we need this and cleanup it? Huan Yang (2): mm/damos/filter: Add workingset page filter mm/damos/filter: Damos filter cleanup include/linux/damon.h | 62 +----------------- mm/damon/Makefile | 2 +- mm/damon/core-test.h | 7 ++ mm/damon/core.c | 93 ++++----------------------- mm/damon/filter.c | 135 +++++++++++++++++++++++++++++++++++++++ mm/damon/filter.h | 119 ++++++++++++++++++++++++++++++++++ mm/damon/paddr.c | 29 +++------ mm/damon/reclaim.c | 48 +++++++++++--- mm/damon/sysfs-schemes.c | 1 + 9 files changed, 325 insertions(+), 171 deletions(-) create mode 100644 mm/damon/filter.c create mode 100644 mm/damon/filter.h