Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2912373pxk; Mon, 28 Sep 2020 03:39:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpymyQkJBHh9jlRWnFPOUchRm3prNFLYz01veZKjeyuK3eDfe5BN1f5H6eOWey2RTjO1W5 X-Received: by 2002:aa7:c896:: with SMTP id p22mr928898eds.382.1601289583761; Mon, 28 Sep 2020 03:39:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601289583; cv=none; d=google.com; s=arc-20160816; b=GGS6N2gQvw9nXzMBaIJqWh/Ukix4FRvox28u4dcpz8GyChmssi+jEPWaEj+kduTLQN N8RFtiNulBr6MbgWk9sC+5MrYuZpDSpBVjQDg2AFj2oxNfPaIltfeESfiCcz9uKfMJoa btimPKweUkjesduqUXql+aPtiYWg6NpXTKzKo4oQQbyBWcGD6fi0+sstmLqtLEr6VsQZ P8vyIBr+7DP/aMdJPy9mNJhI6H4wmfZ2W/jJL1XI+Bi7d76xrkpc2fK4SLXi5UMjsCiq YVhdLnhCTPEmhef77EPhALRr3uIbieHx4i6pN5Shbrz/KJ9vczz+J6dsTpCKFeXi/GTV mwJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=5lenCskr89LpQ2AkgUWGLyG5rz1PujU6V1uVjmWt4d4=; b=BiluS4mmWEDLCF9mnVAPA1pi2j4yzmJGoZqKpGKS4F5AFJgOp1apiA5O6m5AxMHkvh b9COO2s2qj/AbzKZCM3K3cgLd+HY4XlOB9zI87mpm8TgIZ9S80AE+qJvCl/jBpR6CPWn HTOgkhEgEhhdiSmx6+P+AmMNrbMD9S+6fvpQlq9RUVEQQoLDPd8GhK5giks9ka8/+BSD xnHQXLnic7ZW2sDeeDpetetYqvqlTZUgDnQ2mKWawplpj8OU5CYYSe4bk4rN/K2ew5Fn NKFo7ikCiK/5QGj/gQNhHtmQf4iOC0q6AIdg3l3MaXgjeMcbKo7edO2MGs7MxlTJjaJQ /D1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="hiY/JR1m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ha21si337242ejb.147.2020.09.28.03.39.20; Mon, 28 Sep 2020 03:39:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b="hiY/JR1m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbgI1KgQ (ORCPT + 99 others); Mon, 28 Sep 2020 06:36:16 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:13421 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbgI1KgQ (ORCPT ); Mon, 28 Sep 2020 06:36:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1601289375; x=1632825375; h=from:to:cc:subject:date:message-id:mime-version; bh=5lenCskr89LpQ2AkgUWGLyG5rz1PujU6V1uVjmWt4d4=; b=hiY/JR1mEy5OI8881dHLDWBAgfPksfJ99SHxIUekk5lTtFBDel4IPZwM NF1zk/2kZzI+6GrXoH3myz6FCXFMqiTpRTnpE51BywON5WQI1Wfqr8+gQ g/DEZBV7yRKltaLaOTNJJq1AHxKkq7KeK1rSeZu2/iQIyvsGGRn1NzVZu o=; X-IronPort-AV: E=Sophos;i="5.77,313,1596499200"; d="scan'208";a="56638054" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-5dd976cd.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 28 Sep 2020 10:36:14 +0000 Received: from EX13D31EUA001.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan2.iad.amazon.com [10.40.163.34]) by email-inbound-relay-1d-5dd976cd.us-east-1.amazon.com (Postfix) with ESMTPS id 00BCBA1CF1; Mon, 28 Sep 2020 10:36:01 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.161.237) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 28 Sep 2020 10:35:43 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [RFC PATCH 0/5] DAMON: Make coexistable with Idle Page Tracking Date: Mon, 28 Sep 2020 12:35:23 +0200 Message-ID: <20200928103528.4256-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.161.237] X-ClientProxiedBy: EX13D10UWA003.ant.amazon.com (10.43.160.248) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: SeongJae Park NOTE: This is an RFC for future change of DAMON patchsets[1,2,3], which is not merged in the mainline yet. The aim of this RFC is to show how the patchset would be changed in the next version. So, if you have some interest in this RFC, please consider reviewing the DAMON patchset, either. Currently, DAMON is configured to be exclusive with Idle Page Tracking because both of the subsystems use PG_Idle flag and there is no way to synchronize with Idle Page Tracking. Though there are many use cases DAMON could do better than Idle Page Tracking, DAMON cannot fully replace Idle Page Tracking, since - DAMON doesn't support all features of Idle Page Tracking from the beginning (e.g., physical address space is supported from the third DAMON patchset[3]), and - there are some use cases Idle Page Tracking could be more efficient (e.g., page size granularity working set size calculation). Therefore, this patchset makes DAMON coexistable with Idle Page Tracking. As the first decision of making DAMON exclusive was not a good idea, this change will be merged in the next versions of the original patchsets[1,2,3]. Therefore, you could skip detail of the changes but wait for postings of the next versions of the patchsets, except the 4th patch. The changes significantly refactor the code, especially 'damon.c' and 'damon-test.c'. Though the refactoring changes are only straightforward, if you gave 'Reviewed-by' before and you want to drop it due to the changes, please let me know. [1] https://lore.kernel.org/linux-mm/20200817105137.19296-1-sjpark@amazon.com/ [2] https://lore.kernel.org/linux-mm/20200804142430.15384-1-sjpark@amazon.com/ [3] https://lore.kernel.org/linux-mm/20200831104730.28970-1-sjpark@amazon.com/ Sequence of Patches =================== The 1st patch separates DAMON components that unnecessarily implemented in one source file and depend on one config option (CONFIG_DAMON) to multiple files and apply fine-grained dependency. As a result, the core framework part of DAMON becomes coexistable with Idle Page Tracking. Following two patches further refactor the code for cleaner bound between the components. The 4th patch implements a synchronization infrastructure for PG_idle flag users. We implement it to eventually used for DAMON, but the change is independent with DAMON and the also required for Idle Page Tracking itself. This could be picked before DAMON patchsets merged. Finally, the 5th patch updates DAMON to use the PG_idle synchronization infrastructure and fully coexistable with Page Idle Tracking. Baseline and Complete Git Trees =============================== The patches are based on the v5.8 plus DAMON v20 patchset[1], RFC v14 of DAMOS patchset, RFC v8 of physical address space support patchset, RFC v1 of user space improvement[4], and some more trivial fixes (s/snprintf/scnprintf). You can also clone the complete git tree: $ git clone git://github.com/sjp38/linux -b damon-usi/rfc/v1 The web is also available: https://github.com/sjp38/linux/releases/tag/damon-usi/rfc/v1 [1] https://lore.kernel.org/linux-mm/20200817105137.19296-1-sjpark@amazon.com/ [2] https://lore.kernel.org/linux-mm/20200804142430.15384-1-sjpark@amazon.com/ [3] https://lore.kernel.org/linux-mm/20200831104730.28970-1-sjpark@amazon.com/ [4] https://lore.kernel.org/linux-mm/20200915180807.18812-1-sjpark@amazon.com/ SeongJae Park (5): mm/damon: Separate components and apply fine-grained dependencies mm/damon: Separate DAMON schemes application to primitives mm/damon: Move recording feature from core to dbgfs mm/page_idle: Avoid interferences from concurrent users mm/damon/primitives: Make coexistable with Idle Page Tracking .../admin-guide/mm/idle_page_tracking.rst | 22 +- MAINTAINERS | 3 +- include/linux/damon.h | 109 +- include/linux/page_idle.h | 2 + mm/Kconfig | 25 +- mm/Makefile | 2 +- mm/damon-test.h | 724 ----- mm/damon.c | 2754 ----------------- mm/damon/Kconfig | 68 + mm/damon/Makefile | 5 + mm/damon/core-test.h | 253 ++ mm/damon/core.c | 860 +++++ mm/damon/damon.h | 7 + mm/damon/dbgfs-test.h | 264 ++ mm/damon/dbgfs.c | 1158 +++++++ mm/damon/primitives-test.h | 328 ++ mm/damon/primitives.c | 896 ++++++ mm/page_idle.c | 40 + 18 files changed, 3982 insertions(+), 3538 deletions(-) delete mode 100644 mm/damon-test.h delete mode 100644 mm/damon.c create mode 100644 mm/damon/Kconfig create mode 100644 mm/damon/Makefile create mode 100644 mm/damon/core-test.h create mode 100644 mm/damon/core.c create mode 100644 mm/damon/damon.h create mode 100644 mm/damon/dbgfs-test.h create mode 100644 mm/damon/dbgfs.c create mode 100644 mm/damon/primitives-test.h create mode 100644 mm/damon/primitives.c -- 2.17.1