From patchwork Mon Jul 1 19:27:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13718583 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 76F95C3065B for ; Mon, 1 Jul 2024 19:27:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED5936B00A3; Mon, 1 Jul 2024 15:27:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E37DD6B00A5; Mon, 1 Jul 2024 15:27:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3E176B00AD; Mon, 1 Jul 2024 15:27:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9CB956B00A3 for ; Mon, 1 Jul 2024 15:27:16 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4A1B3C1BB1 for ; Mon, 1 Jul 2024 19:27:16 +0000 (UTC) X-FDA: 82292167272.04.39C9B8F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 7D9504001D for ; Mon, 1 Jul 2024 19:27:14 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=O+nK9tiY; spf=pass (imf17.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719862023; a=rsa-sha256; cv=none; b=ZritvoerJCuyVd+gaBn6V+xEGfb9+nGTd0tl8/TVw6JbzDVJtANPY7lYT8+IiU+b/D62j5 ZWFXCaLm75b/FazoHsfDDTPISY58KZ+4xSG3EdHd3YsDMTRUvHgFQsCxMLXGaFbl6a3xeM 865m90kCtcZ2OT9zmxLbyb0rLlPs3qE= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=O+nK9tiY; spf=pass (imf17.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719862023; 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=0jdBgm8UA8l4RzomdXPKBVBMy5//g7BGaFqHMjVjGLI=; b=PZHdRul9QujaWa1H9fNHQl24bfTspemf3URfKyrm5yVILkC7K3SWQ4D4Ws/amTPyXbrQdg lWJUYJ+cA6j+V8dN74hW//84fwiLKCEvIyFbpebdVT0dAKgBmrVi39xOCqjO+wGQbYyD6C FaGVgTMs7Hg/7brbIUd1pAiMmhgqTrs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A46F961783; Mon, 1 Jul 2024 19:27:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5AC5C4AF0A; Mon, 1 Jul 2024 19:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719862033; bh=xIHZ0L/qw5eQQs5fbReQPpk6P9pGxGMQqK3yOrF7MWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O+nK9tiYcgMpX53+AWbsywu8xs749rQaWCssGXzuDSadnTFeYIMlrXu0ew3T9dogi IkTIfMtrF4gwrS8lz31uYJoiseCCJZBN6IK42mV5Ps+naC34CloIetMhyW+IIW0Tzm a3kLjxoOisBw1iI+iRFYDLkTJ9sfD7S87UQtjomfKCfkGG2nQKLRtrEbXiCK4xBjNB OxX6IPFsLg/kxTSojMTgp7r4eDXpkwob7xOWZAfAWVb9R2EKvi3clvf/8ukmnI4FaX /62gWPAvoqSIs4yka7Lz/BmMO2EbhNhKKwygKrTXIXoPsFmunFbrhZahPo/WoEyVKy clgLU8P1HYwIA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/9] Docs/admin-guide/mm/damon/start: add access pattern snapshot example Date: Mon, 1 Jul 2024 12:27:00 -0700 Message-Id: <20240701192706.51415-4-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240701192706.51415-1-sj@kernel.org> References: <20240701192706.51415-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: ewwaj9d6467dobziquzt1x5j1yo7yqom X-Rspamd-Queue-Id: 7D9504001D X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719862034-722192 X-HE-Meta: U2FsdGVkX1/XlHj32mEWbmD20YnlTMHGsQ2knoHP1t4Nd9sAiMMBZbBCOgBLCIDTLYEgpzMHdUHOOyXOGQqts+IScZkb1LhA9hs749iK99nNK4kmV04sj9LETMusTJu0+p8LOCAEus6CW/ihvLZd1uhomhxLVtmLhEqqJTxyYfFdGRHJbrcEtJyuCG9uz04McUJ98XLwuHlUvBKk/cDHPhOPQCgArmAVNRPlCt9DxdFd7F1RHvhvCJTM8hk19rHHAUb4plZfLgCmlcQxFbAb8MkuZg0N2DeXRx8oox5f20jHklZ5fjNlaFA9U4mSrxXKx9p4yjULN1gBPRdxIjw7HMlViG1//SdghYK0lNVk6Ck9dZs0EtLX9xKmXUgIxIJ4ACx7ge7RB0xFtsKnuTTaWMQINdnlzERHgZBpn8tsiD0ZfqWtixCPqw8NqFzJYhqmxdh0/vQh4v+ZNoqvUOgPutbf6kZVq7IPA+1MIIms7M2tEN+ska/JZpId1pH5G8VjFHdjlmEHcJ3OF/YXNKEST7gHJ87Rs5ZYfliJC21GBHS2/s3nvvtk9tlHg9E65fGBEkAvVccIRb2CSv09AHUesoRY6e6CJ+xRnX5ugfrnlY/HBYYe4CH8zq30F/bBOhzH1lkcHxorM0m0pODhlU+B8sLEwDkDFvGtlLpil/GOV+tUwuaz8eIqSSJ4zeLob20v35/7vNIny6YlKRN0OYMrDmS9Z2dhs3sWKH4lQIax/hzMztsLqhQmvBQUMchszwm2ivPFapN4swDD+POS/v5fiIL/5subutqQ3rfmllbOBWArcnNBdOpwKrSXKgVhJ7K4I3l2MvQ71nXYU2KMyinC6UYSyxpPGHSz54gc5MO1Y0I8Lwt0WS1k1Wy0ostBC4c3JhwbyZD1fsXg7QgBYsCtIWRHwe/eCJYLrAlznHL1gtyd4y/tunser8GMn2V6SixrCDGqorQhAYrtA3Jszwm FhU4gJ/a S7KOhTcrOE1M18zZJY7X68PEDHkSQAPUqvZugLZC0oyOdQt58eZRudK1jSEW9IK9WBXGst4e6Wh4VKKVEZzvp+Tu7OPOA030mQmNYNybAIJnUN8zEVlrSddBfaExsXKLVhlfwKIpREv/6BB9kR2gpwYH//54MLUNl14nQ079Nx5NmPNLabuL81IsMmBkIxhkiPb997/Vsg1X8fpuMWOk3Nkyf8y/BnvprD7Agi7tSlXopa5OtkHCsTLISDqbP+70VQEaV 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: DAMON user-space tool (damo) provides access pattern snapshot feature, which is expected to be frequently used for real time access pattern analysis. The snapshot output is also showing what DAMON provides on its own, including the 'age' information. In contrast, the recorded access patterns, which is shown as an example usage on the quick start section, shows what users can make from what DAMON provided. It includes information that generated outside of DAMON and makes the 'age' concept bit unclear. Hence snapshot output is easier at understanding the raw realtime output of DAMON. Add the snapshot usage example on the quick start section. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/start.rst | 46 ++++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/start.rst b/Documentation/admin-guide/mm/damon/start.rst index 7aa0071ff1c3..054010a7f3d8 100644 --- a/Documentation/admin-guide/mm/damon/start.rst +++ b/Documentation/admin-guide/mm/damon/start.rst @@ -34,18 +34,56 @@ detail) of DAMON, you should ensure :doc:`sysfs ` is mounted. +Snapshot Data Access Patterns +============================= + +The commands below show the memory access pattern of a program at the moment of +the execution. :: + + $ git clone https://github.com/sjp38/masim; cd masim; make + $ sudo damo start "./masim ./configs/stairs.cfg --quiet" + $ sudo ./damo show + 0 addr [85.541 TiB , 85.541 TiB ) (57.707 MiB ) access 0 % age 10.400 s + 1 addr [85.541 TiB , 85.542 TiB ) (413.285 MiB) access 0 % age 11.400 s + 2 addr [127.649 TiB , 127.649 TiB) (57.500 MiB ) access 0 % age 1.600 s + 3 addr [127.649 TiB , 127.649 TiB) (32.500 MiB ) access 0 % age 500 ms + 4 addr [127.649 TiB , 127.649 TiB) (9.535 MiB ) access 100 % age 300 ms + 5 addr [127.649 TiB , 127.649 TiB) (8.000 KiB ) access 60 % age 0 ns + 6 addr [127.649 TiB , 127.649 TiB) (6.926 MiB ) access 0 % age 1 s + 7 addr [127.998 TiB , 127.998 TiB) (120.000 KiB) access 0 % age 11.100 s + 8 addr [127.998 TiB , 127.998 TiB) (8.000 KiB ) access 40 % age 100 ms + 9 addr [127.998 TiB , 127.998 TiB) (4.000 KiB ) access 0 % age 11 s + total size: 577.590 MiB + $ sudo ./damo stop + +The first command of the above example downloads and builds an artificial +memory access generator program called ``masim``. The second command asks DAMO +to execute the artificial generator process start via the given command and +make DAMON monitors the generator process. The third command retrieves the +current snapshot of the monitored access pattern of the process from DAMON and +shows the pattern in a human readable format. + +Each line of the output shows which virtual address range (``addr [XX, XX)``) +of the process is how frequently (``access XX %``) accessed for how long time +(``age XX``). For example, the fifth region of ~9 MiB size is being most +frequently accessed for last 300 milliseconds. Finally, the fourth command +stops DAMON. + +Note that DAMON can monitor not only virtual address spaces but multiple types +of address spaces including the physical address space. + + Recording Data Access Patterns ============================== The commands below record the memory access patterns of a program and save the monitoring results to a file. :: - $ git clone https://github.com/sjp38/masim - $ cd masim; make; ./masim ./configs/zigzag.cfg & + $ ./masim ./configs/zigzag.cfg & $ sudo damo record -o damon.data $(pidof masim) -The first two lines of the commands download an artificial memory access -generator program and run it in the background. The generator will repeatedly +The line of the commands run the artificial memory access +generator program again. The generator will repeatedly access two 100 MiB sized memory regions one by one. You can substitute this with your real workload. The last line asks ``damo`` to record the access pattern in the ``damon.data`` file.