From patchwork Mon Mar 18 13:28:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Prasad, Aravinda" X-Patchwork-Id: 13595372 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 7151FC54E58 for ; Mon, 18 Mar 2024 13:24:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 021968E0003; Mon, 18 Mar 2024 09:24:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F132B8D0001; Mon, 18 Mar 2024 09:24:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB4998E0003; Mon, 18 Mar 2024 09:24:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C9DCE8D0001 for ; Mon, 18 Mar 2024 09:24:38 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7521B120CA4 for ; Mon, 18 Mar 2024 13:24:38 +0000 (UTC) X-FDA: 81910229436.03.869137C Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by imf12.hostedemail.com (Postfix) with ESMTP id 5582C40007 for ; Mon, 18 Mar 2024 13:24:36 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=R1I6NEw3; spf=pass (imf12.hostedemail.com: domain of aravinda.prasad@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=aravinda.prasad@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710768276; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iXNXKvs31lX8vB6K4d1tLlEDpR/fWg33KlNsAPwm8hE=; b=up/z2K1vLsrzAna76OlLp5/pKc+qTXj8s9vRv3hqQsDG8PHxl6jEOTrGFED82u5trbXiNH 5lgD4vd93+6AYV1XvwZpn7nR1hK5ra31/7+uefgClitfkLh4LObFkmChr/0JBT39SQrUGE 8hC+8Og7XGKFBB5EUGSLCeKpi6QYhrs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710768276; a=rsa-sha256; cv=none; b=2pYLcHwDRizzOes+pvWBM1i5ktVfURlQXT2isquzGM98+B0uWUs/0NzzPI7+OHjlXWOTeO szVa4zrJm2SFdWbNyPIRVW76heU5yvvP+SoruLQE1dyuyG3faVmhFS3J9lhrgZf1xhPhVb yDSArbc+xsxA8W3lB0giwfwKd75PxnI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=R1I6NEw3; spf=pass (imf12.hostedemail.com: domain of aravinda.prasad@intel.com designates 198.175.65.10 as permitted sender) smtp.mailfrom=aravinda.prasad@intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710768276; x=1742304276; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uGFUoH8Waa+J7z1fmC561WGAlEYBZGb45Er8B07BwhE=; b=R1I6NEw39ZxgEMMGS9sxnzK2DQhrpOWgGaI0ArzfjFUHhdEwcdSSHZrR w0pD5pRtuqLrkrA9K1NizXvAs5Q1xZG9pI910VUpZwR0n6qDcSSDoGdlP tVqXD1C7PZBANSBXfAq7m3QK6fkxxjijCgZHkaR2V2DpJtAnRnBBwBkFu T87jEm7lmdTTs5F/8qoffwd/1Xn576w8fbx9vjYQoPRhdGgtdT1XlbKHU lkMibiIjsnc9/KDDli/DftIrDtq67p9w0rUylIiJDHwu0xz54YT6LfuLs Sjg/KCHOMXALFnYkoM990K1N07E4TbSn0L6K7SjUSCrlrqWXrGAydLo47 g==; X-IronPort-AV: E=McAfee;i="6600,9927,11016"; a="23037997" X-IronPort-AV: E=Sophos;i="6.07,134,1708416000"; d="scan'208";a="23037997" 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:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,134,1708416000"; d="scan'208";a="14102868" 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:31 -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 3/3] mm/damon: documentation updates Date: Mon, 18 Mar 2024 18:58:48 +0530 Message-Id: <20240318132848.82686-4-aravinda.prasad@intel.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20240318132848.82686-1-aravinda.prasad@intel.com> References: <20240318132848.82686-1-aravinda.prasad@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5582C40007 X-Rspam-User: X-Stat-Signature: 4xecno46i8a6w4bbij1s4eeeoujk5g4e X-Rspamd-Server: rspam03 X-HE-Tag: 1710768276-498981 X-HE-Meta: U2FsdGVkX1/HRvSqAolIgqotssBcMtRllpxdBEx4zizL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sO5HnGJWBee2cHJA== X-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: This patch updates the kernel documentation. Signed-off-by: Aravinda Prasad --- Documentation/mm/damon/design.rst | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 5620aab9b385..59014ecbb551 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -139,6 +139,48 @@ the interference is the responsibility of sysadmins. However, it solves the conflict with the reclaim logic using ``PG_idle`` and ``PG_young`` page flags, as Idle page tracking does. +Profiling enhancement for virtual address space +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For virtual address space tracking, relying on checking Accessed bit(s) only +at the leaf level of the page table is inefficient. Hardware architectures +have supported Accessed bit(s) at all levels of the page table tree by +updating them during the page table walk. Hence, DAMON dynamically +profiles different levels (PMD/PUD/P4D) of a multi-level page table tree. + +DAMON leverages the following key insight: a data page that is accessed +should also have the Accessed bit set at PMD, PUD, P4D, and PGD entry. +Similarly, if the Accessed bit in a PGD entry (or a PUD/PMD entry) is +not set, then none of the data pages under the PGD entry (or PUD/PMD +entry) subtree are accessed. DAMON profiles Accessed bits at the highest +possible level of the page table tree to identify the regions that are +accessed. + +For example, consider a region and the sampling address (SA) in the below +figure. The address range of a PUD entry corresponding to SA is within +region bounds and hence PUD is picked for checking and setting the +Accessed bits. However, this not true if P4D is picked for profiling. +Hence in this case PUD is the highest possible level that can be picked +for profiling. + ....... + + P4D + + ....... + / \ + / \ + / \ + / \ + / \ + / ....... \ + / + PUD + \ + / ....... \ + / / \ \ +- - - - - +-----*---*--+====+-*------+- -*- - - + + # SA # + + + # # + +- - - - - +------------+====+--------+- - - - - + + | ----- DAMON region ------| + Core Logics ===========