From mboxrd@z Thu Jan 1 00:00:00 1970 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 C16F2C54E58 for ; Mon, 18 Mar 2024 13:24:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A3536B0085; Mon, 18 Mar 2024 09:24:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 353026B0087; Mon, 18 Mar 2024 09:24:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21B2A6B0088; Mon, 18 Mar 2024 09:24:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0C8D96B0085 for ; Mon, 18 Mar 2024 09:24:16 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8F054A0BB7 for ; Mon, 18 Mar 2024 13:24:15 +0000 (UTC) X-FDA: 81910228470.09.29DB815 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by imf01.hostedemail.com (Postfix) with ESMTP id EF9824001D for ; Mon, 18 Mar 2024 13:24:12 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ETvieJzR; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf01.hostedemail.com: domain of aravinda.prasad@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=aravinda.prasad@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710768253; 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=UiVe44WJYkclLAb80jOi0xNmjZj75E206edJgEN15z4=; b=v16cbGmA4SGlbo0wfqim3B9qzsUQfPZJNz3inWpQhClPikm1eDuAJd/2PIOKiph4BD0Ipk z+waSvAeFiEgT0tIVYte1hj5GUk2gHc8nzYi6+NIB//SF8i7REEdosjFtYJklEsA1jOdkD ijTiFeHv1t1GTZZXWIzwET5y5TO+1Co= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=ETvieJzR; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf01.hostedemail.com: domain of aravinda.prasad@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=aravinda.prasad@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710768253; a=rsa-sha256; cv=none; b=ACEbRtgpCFuASDbUpNcIjqHmblhjqX6u8Zrjj79IMB9vrvtAxoxPU/z/T2HJqef+bSlsER wRMnuD935ScBGa1fjjAl/sp73P+QBtaWosTYgZ7MrXfk5zNJP5NWXK8/dXQWeIKd/rheJo OR/ps/Aes2/er8gzirnfrBI1+9USMXg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710768253; x=1742304253; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=6XG9peCgdkVt7DtdGWYG9FGSKJXneNx01xZftM/aGBg=; b=ETvieJzRjcxdFWJu87vRJn6CtalDsR6R6+0jDHuJ9BdxubTNg06mhCB/ liaRfVdPPfHQPtOxTXLM5tYnGaYm8Wc0CoRVxQlYf3O11WLHuNWGR7cLI z6MwgWrdztfAotp1JKJIUXqJNau7XYziWukcXnqq2SW+vbJNu6aWK5/DI 90VNFzhGde7OlB4T8HLjNM60o+g/PnTcNaVaokCY6T82WaAx9eNmbbgxX JWiPhaxnkHlWxJjvT56Aygf18l7XtzEbylpr5ZU+hgbvw+E/hRy8wYbNW QL6waoirEAOWI7pMZDuafWGxoKZWo2FgD+31rycnTVEUpEhmo3uiV4lIa Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11016"; a="23037910" X-IronPort-AV: E=Sophos;i="6.07,134,1708416000"; d="scan'208";a="23037910" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2024 06:24:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,134,1708416000"; d="scan'208";a="14102713" Received: from adr-par-inspur1.iind.intel.com ([10.223.93.209]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2024 06:24:07 -0700 From: Aravinda Prasad To: damon@lists.linux.dev, linux-mm@kvack.org, sj@kernel.org, linux-kernel@vger.kernel.org Cc: aravinda.prasad@intel.com, s2322819@ed.ac.uk, sandeep4.kumar@intel.com, ying.huang@intel.com, dave.hansen@intel.com, dan.j.williams@intel.com, sreenivas.subramoney@intel.com, antti.kervinen@intel.com, alexander.kanevskiy@intel.com Subject: [PATCH v2 0/3] mm/damon: Profiling enhancements for DAMON Date: Mon, 18 Mar 2024 18:58:45 +0530 Message-Id: <20240318132848.82686-1-aravinda.prasad@intel.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EF9824001D X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: mgg9onizbgdumg4qu7r7188pbqto38a1 X-HE-Tag: 1710768252-509249 X-HE-Meta: U2FsdGVkX1+4lQJLqMQ+QCPxl3zU4SVK/Z4XV3LZEM0ihkoxj/eQCoQJPxAx51YKRaiEUBJJvqhLMUGfC0PGrGi2/RDhePLETmNdaNRNtUZdN/LLXjPH2h+nR2SrP10hvJmZ8dgbtvwwTEvzrZw81VkqGKKDGdcXHDe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-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: DAMON randomly samples one or more pages in every region and tracks accesses to them using the ACCESSED bit in PTE (or PMD for 2MB pages). When the region size is large (e.g., several GBs), which is common for large footprint applications, detecting whether the region is accessed or not completely depends on whether the pages that are actively accessed in the region are picked during random sampling. If such pages are not picked for sampling, DAMON fails to identify the region as accessed. However, increasing the sampling rate or increasing the number of regions increases CPU overheads of kdamond. This patch proposes profiling different levels of the application’s page table tree to detect whether a region is accessed or not. This patch set is based on the observation that, when the accessed bit for a page is set, the accessed bits at the higher levels of the page table tree (PMD/PUD/PGD) corresponding to the path of the page table walk are also set. Hence, it is efficient to check the accessed bits at the higher levels of the page table tree to detect whether a region is accessed or not. For example, if the access bit for a PUD entry is set, then one or more pages in the 1GB PUD subtree is accessed as each PUD entry covers 1GB mapping. Hence, instead of sampling thousands of 4K/2M pages to detect accesses in a large region, sampling at the higher level of page table tree is faster and efficient. This patch set is based on 6.8-rc5 kernel (commit: f48159f8, mm-unstable tree) Changes since v1 [1] ==================== - Added support for 5-level page table tree - Split the patch to mm infrastructure changes and DAMON enhancements - Code changes as per comments on v1 - Added kerneldoc comments [1] https://lkml.org/lkml/2023/12/15/272 Evaluation: - MASIM benchmark with 1GB, 10GB, 100GB footprint with 10% hot data and 5TB with 10GB hot data. - DAMON: 5ms sampling, 200ms aggregation interval. Rest all parameters set to default value. - DAMON+PTP: Page table profiling applied to DAMON with the above parameters. Profiling efficiency in detecting hot data: Footprint 1GB 10GB 100GB 5TB --------------------------------------------- DAMON >90% <50% ~0% 0% DAMON+PTP >90% >90% >90% >90% CPU overheads (in billion cycles) for kdamond: Footprint 1GB 10GB 100GB 5TB --------------------------------------------- DAMON 1.15 19.53 3.52 9.55 DAMON+PTP 0.83 3.20 1.27 2.55 A detailed explanation and evaluation can be found in the arXiv paper: https://arxiv.org/pdf/2311.10275.pdf Aravinda Prasad (3): mm/damon: mm infrastructure support mm/damon: profiling enhancement mm/damon: documentation updates Documentation/mm/damon/design.rst | 42 ++++++ arch/x86/include/asm/pgtable.h | 20 +++ arch/x86/mm/pgtable.c | 28 +++- include/linux/mmu_notifier.h | 36 +++++ include/linux/pgtable.h | 79 ++++++++++ mm/damon/vaddr.c | 233 ++++++++++++++++++++++++++++-- 6 files changed, 424 insertions(+), 14 deletions(-) -- 2.21.3