From nobody Thu Feb 12 23:02:20 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C594192B96; Thu, 2 Jan 2025 19:01:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844506; cv=none; b=TBx2jJD5SCM3wAl0Y+MnXMqTp2eyH7TYdCms/rqM6uoVTOp1sUz5mRRgqiUkTKrCiVwGwYInwFM47XsNwV00oeLCtPEb+6igGHRg5kibUtf9qHiutVfFlES1Siqj5+h7QpBXr1/9XB5HN9uubCOVs/HYFIWGLhxYL55rkpi1iZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844506; c=relaxed/simple; bh=4/XblnIScbbgUAgFK7pLL4JlbO5Pquped+azNdLMH04=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JUkBuDvKWmr8Ghi7gHxkTQB+On3bDsser+PdiX4S5YYrl8VFtGDhSAiOhcr/c8m1Fz3xzJv9EnNMgsS8MEDSW2vhtSv/YRT/ytg4YNHjxI5JZ0SLhhK8wutkNZzCos/3HOzatfEY5bnKOZ3rHRoZIws1SO+8aiDfyHp6PWEDBwo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KlaNlt1q; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KlaNlt1q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8238C4CEDC; Thu, 2 Jan 2025 19:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735844506; bh=4/XblnIScbbgUAgFK7pLL4JlbO5Pquped+azNdLMH04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlaNlt1q/Xrnqg9KnIF0LC2RgX+Ac0rYTpw11hklMkfAH+IxAsVsRuJCJ5h4yXHLe IfhtvCRALqjhqW1nvvDtp0Q/us47BbG5lAbxh8wH8u7+CdOGvO95WwZFNwSp3pdgV2 iKxRQ9X6q7XuGXlR/GV07BAQuIzTCQsqRrBwvUyqqdBbBJoYZ0OML/bIDrPJRTYwGS 5+9/kuIUoWmzE9be7bb1pLwsA7T5I5TSK2V6wUag6gE4vzlnBZFYe0UmHrTDD1p8ym oFlbv/P89jGbMgaBZkNDW4oWBg/aD4tuUQbzw/sz3/DpxjFtbUHrPiWaQkOZIvHm3Q hNAbNN++fIYbQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 1/5] Docs/mm/damon/design: add monitoring parameters tuning guide Date: Thu, 2 Jan 2025 11:01:34 -0800 Message-Id: <20250102190138.47258-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250102190138.47258-1-sj@kernel.org> References: <20250102190138.47258-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" DAMON monitoring parameters including sampling and aggregation intervals require tunings for given workloads. However, the fact is not explicitly documented. Also there is no official guide to help the tuning. This apparently confused a number of people[1]. Add a guide on the design document. [1] https://lore.kernel.org/20241202175459.2005526-1-sj@kernel.org Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index 0265aaef2544..cc405e15d1b2 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -203,6 +203,8 @@ This scheme, however, cannot preserve the quality of th= e output if the assumption is not guaranteed. =20 =20 +.. _damon_design_adaptive_regions_adjustment: + Adaptive Regions Adjustment ~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 @@ -264,6 +266,52 @@ tracepoints. For more details, please refer to the do= cumentations for respectively. =20 =20 +Monitoring Parameters Tuning Guide +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In short, set ``aggregation interval`` to capture meaningful amount of acc= esses +for the purpose. The amount of accesses can be measured using ``nr_access= es`` +and ``age`` of regions in the aggregated monitoring results snapshot. The +default value of the interval, ``100ms``, turns out to be too short in many +cases. Set ``sampling interval`` proportional to ``aggregation interval``= . By +default, ``1/20`` is recommended as the ratio. + +``Aggregation interval`` should be set as the time interval that the workl= oad +can make an amount of accesses for the monitoring purpose, within the inte= rval. +If the interval is too short, only small number of accesses are captured. = As a +result, the monitoring results look everything is samely accessed only rar= ely. +For many purposes, that would be useless. If it is too long, however, the= time +to converge regions with the :ref:`regions adjustment mechanism +` can be too long, depending on = the +time scale of the given purpose. This could happen if the workload is act= ually +making only rare accesses but the user thinks the amount of accesses for t= he +monitoring purpose too high. For such cases, the target amount of access = to +capture per ``aggregation interval`` should carefully reconsidered. Also,= note +that the captured amount of accesses is represented with not only +``nr_accesses``, but also ``age``. For example, even if every region on t= he +monitoring results show zero ``nr_accesses``, regions could still be +distinguished using ``age`` values as the recency information. + +Hence the optimum value of ``aggregation interval`` depends on the access +intensiveness of the workload. The user should tune the interval based on= the +amount of access that captured on each aggregated snapshot of the monitori= ng +results. + +Note that the default value of the interval is 100 milliseconds, which is = too +short in many cases, especially on large systems. + +``Sampling interval`` defines the resolution of each aggregation. If it i= s set +too large, monitoring results will look like every region was samely rarely +accessed, or samely frequently accessed. That is, regions become +undistinguishable based on access pattern, and therefore the results will = be +useless in many use cases. If ``sampling interval`` is too small, it will= not +degrade the resolution, but will increase the monitoring overhead. If it = is +appropriate enough to provide a resolution of the monitoring results that +sufficient for the given purpose, it shouldn't be unnecessarily further +lowered. It is recommended to be set proportional to ``aggregation interv= al``. +By default, the ratio is set as ``1/20``, and it is still recommended. + + .. _damon_design_damos: =20 Operation Schemes --=20 2.39.5 From nobody Thu Feb 12 23:02:20 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B21A1B4228; Thu, 2 Jan 2025 19:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844509; cv=none; b=jluhYhca/QjJm9DCgh0nZyVIZ9oFwgukWuwAuAUXw0l1TaZYn0EK0GHjSDptFClWiSEmJYM8kCzXAkEsg4yR9a3Gjrmv8687xR7iYdKhCSroTQRBRAnMoY8QHM9KXZi7ypi6fx80+PaQtIdu+k/5Y9sKFXYBkcz7QBcvjk7R9l0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844509; c=relaxed/simple; bh=OYYSIzDz6vCDJMj+2WTbNJhocSwTQ7N8sl66wc9BMJo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=OCoLta4Bt5hxj0BQA6smLVOdPEuv4JEofAgOoq0DN+GPJIRqvDRUgPFET05uUefnHA3uttvsX3F/rDG4IS7ayd3L5PEFj1t/JpZRZxHoTbu+OiJIIhn7P31uLRWmvliO7UBbOBQKomBGdTl9l7CzYushMt6NMd3ec9DhB0RKfQk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nMnc0YfE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nMnc0YfE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB141C4AF09; Thu, 2 Jan 2025 19:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735844508; bh=OYYSIzDz6vCDJMj+2WTbNJhocSwTQ7N8sl66wc9BMJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMnc0YfE1Neu4L/4fcyrCd4npQNt4JkDJDJgPwP11kRirqMZ1R+ZZiquowUbV99KG +RzOxtO18F0DqS6olQimGIOY99UXsdCPMkz18U0Jb8JW+p185+f8W9lWYFGgAjFh2y ll3ifZLlnT3r6frIvRs5oQiTkltArCCArhCZC3iICm8QLbbDnRjYTUDLnM9IfRhF74 Kfpe6rToCUD6obm8e6wSikkg70r3ddqpbkuIpgYXHhywYBG2pl5XrqhRPIM6Zjp6at +2Hurb8clVqlNeStzfJUrT1mAz38jDxwOcJFelHFVu4aXOnK37dYDDl0jeUMrhoq7C ADs+zILD1e7hw== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 2/5] Docs/mm/damon: add an example monitoring intervals tuning Date: Thu, 2 Jan 2025 11:01:35 -0800 Message-Id: <20250102190138.47258-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250102190138.47258-1-sj@kernel.org> References: <20250102190138.47258-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add a DAMON monitoring intervals tuning example that follows the guide. The example includes outputs of the tuning steps which are collected from a real server workloads. The example will help users better understand the guide and what outputs they can expect in what way. The easier understanding and verification of the expectation will also help finding rooms to improvement on the guide. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 9 + .../monitoring_intervals_tuning_example.rst | 247 ++++++++++++++++++ 2 files changed, 256 insertions(+) create mode 100644 Documentation/mm/damon/monitoring_intervals_tuning_exam= ple.rst diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index cc405e15d1b2..dd654720c433 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -266,6 +266,8 @@ tracepoints. For more details, please refer to the doc= umentations for respectively. =20 =20 +.. _damon_design_monitoring_params_tuning_guide: + Monitoring Parameters Tuning Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 @@ -311,6 +313,13 @@ sufficient for the given purpose, it shouldn't be unne= cessarily further lowered. It is recommended to be set proportional to ``aggregation interv= al``. By default, the ratio is set as ``1/20``, and it is still recommended. =20 +Refer to below documents for an example tuning based on the above guide. + +.. toctree:: + :maxdepth: 1 + + monitoring_intervals_tuning_example + =20 .. _damon_design_damos: =20 diff --git a/Documentation/mm/damon/monitoring_intervals_tuning_example.rst= b/Documentation/mm/damon/monitoring_intervals_tuning_example.rst new file mode 100644 index 000000000000..334a854efb40 --- /dev/null +++ b/Documentation/mm/damon/monitoring_intervals_tuning_example.rst @@ -0,0 +1,247 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +DAMON Moniting Interval Parameters Tuning Example +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +DAMON's monitoring parameters need tuning based on given workload and the +monitoring purpose. There is a :ref:`tuning guide +` for that. This document +provides an example tuning based on the guide. + +Setup +=3D=3D=3D=3D=3D + +For below example, DAMON of Linux kernel v6.11 and `damo +`_ (DAMON user-space tool) v2.5.9 was u= sed to +monitor and visualize access patterns on the physical address space of a s= ystem +running a real-world server workload. + +5ms/100ms intervals: Too Short Interval +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Let's start by capturing the access pattern snapshot on the physical addre= ss +space of the system using DAMON, with the default interval parameters (5 +milliseconds and 100 milliseconds for the sampling and the aggregation +intervals, respectively). Wait ten minutes between the start of DAMON and +the capturing of the snapshot, to show a meaningful time-wise access patte= rns. +:: + + # damo start + # sleep 600 + # damo record --snapshot 0 1 + # damo stop + +Then, list the DAMON-found regions of different access patterns, sorted by= the +"access temperature". "Access temperature" is a metric representing the +access-hotness of a region. It is calculated as a weighted sum of the acc= ess +frequency and the age of the region. If the access frequency is 0 %, the +temperature is multipled by minus one. That is, if a region is not access= ed, +it gets minus temperature and it gets lower as not accessed for longer tim= e. +The sorting is in temperature-ascendint order, so the region at the top of= the +list is the coldest, and the one at the bottom is the hottest one. :: + + # damo report access --sort_regions_by temperature + 0 addr 16.052 GiB size 5.985 GiB access 0 % age 5.900 s # c= oldest + 1 addr 22.037 GiB size 6.029 GiB access 0 % age 5.300 s + 2 addr 28.065 GiB size 6.045 GiB access 0 % age 5.200 s + 3 addr 10.069 GiB size 5.983 GiB access 0 % age 4.500 s + 4 addr 4.000 GiB size 6.069 GiB access 0 % age 4.400 s + 5 addr 62.008 GiB size 3.992 GiB access 0 % age 3.700 s + 6 addr 56.795 GiB size 5.213 GiB access 0 % age 3.300 s + 7 addr 39.393 GiB size 6.096 GiB access 0 % age 2.800 s + 8 addr 50.782 GiB size 6.012 GiB access 0 % age 2.800 s + 9 addr 34.111 GiB size 5.282 GiB access 0 % age 2.300 s + 10 addr 45.489 GiB size 5.293 GiB access 0 % age 1.800 s # h= ottest + total size: 62.000 GiB + +The list shows not seemingly hot regions, and only minimum access pattern +diversity. Every region has zero access frequency. The number of region = is +10, which is the default ``min_nr_regions value``. Size of each region is= also +nearly idential. We can suspect this is because =E2=80=9Cadaptive regions= adjustment=E2=80=9D +mechanism was not well working. As the guide suggested, we can get relati= ve +hotness of regions using ``age`` as the recency information. That would be +better than nothing, but given the fact that the longest age is only about= 6 +seconds while we waited about ten minuts, it is unclear how useful this wi= ll +be. + +The temperature ranges to total size of regions of each range histogram +visualization of the results also shows no interesting distribution patter= n. :: + + # damo report access --style temperature-sz-hist + + [-,590,000,000, -,549,000,000) 5.985 GiB |********** | + [-,549,000,000, -,508,000,000) 12.074 GiB |********************| + [-,508,000,000, -,467,000,000) 0 B | | + [-,467,000,000, -,426,000,000) 12.052 GiB |********************| + [-,426,000,000, -,385,000,000) 0 B | | + [-,385,000,000, -,344,000,000) 3.992 GiB |******* | + [-,344,000,000, -,303,000,000) 5.213 GiB |********* | + [-,303,000,000, -,262,000,000) 12.109 GiB |********************| + [-,262,000,000, -,221,000,000) 5.282 GiB |********* | + [-,221,000,000, -,180,000,000) 0 B | | + [-,180,000,000, -,139,000,000) 5.293 GiB |********* | + total size: 62.000 GiB + +In short, the parameters provide poor quality monitoring results for hot +regions detection. According to the :ref:`guide +`, this is due to the too sho= rt +aggregation interval. + +100ms/2s intervals: Starts Showing Small Hot Regions +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +Following the guide, increase the interval 20 times (100 milliseocnds and 2 +seconds for sampling and aggregation intervals, respectively). :: + + # damo start -s 100ms -a 2s + # sleep 600 + # damo record --snapshot 0 1 + # damo stop + # damo report access --sort_regions_by temperature + 0 addr 10.180 GiB size 6.117 GiB access 0 % age 7 m 8 s # c= oldest + 1 addr 49.275 GiB size 6.195 GiB access 0 % age 6 m 14 s + 2 addr 62.421 GiB size 3.579 GiB access 0 % age 6 m 4 s + 3 addr 40.154 GiB size 6.127 GiB access 0 % age 5 m 40 s + 4 addr 16.296 GiB size 6.182 GiB access 0 % age 5 m 32 s + 5 addr 34.254 GiB size 5.899 GiB access 0 % age 5 m 24 s + 6 addr 46.281 GiB size 2.995 GiB access 0 % age 5 m 20 s + 7 addr 28.420 GiB size 5.835 GiB access 0 % age 5 m 6 s + 8 addr 4.000 GiB size 6.180 GiB access 0 % age 4 m 16 s + 9 addr 22.478 GiB size 5.942 GiB access 0 % age 3 m 58 s + 10 addr 55.470 GiB size 915.645 MiB access 0 % age 3 m 6 s + 11 addr 56.364 GiB size 6.056 GiB access 0 % age 2 m 8 s + 12 addr 56.364 GiB size 4.000 KiB access 95 % age 16 s + 13 addr 49.275 GiB size 4.000 KiB access 100 % age 8 m 24 s # h= ottest + total size: 62.000 GiB + # damo report access --style temperature-sz-hist + + [-42,800,000,000, -33,479,999,000) 22.018 GiB |***************** | + [-33,479,999,000, -24,159,998,000) 27.090 GiB |********************| + [-24,159,998,000, -14,839,997,000) 6.836 GiB |****** | + [-14,839,997,000, -5,519,996,000) 6.056 GiB |***** | + [-5,519,996,000, 3,800,005,000) 4.000 KiB |* | + [3,800,005,000, 13,120,006,000) 0 B | | + [13,120,006,000, 22,440,007,000) 0 B | | + [22,440,007,000, 31,760,008,000) 0 B | | + [31,760,008,000, 41,080,009,000) 0 B | | + [41,080,009,000, 50,400,010,000) 0 B | | + [50,400,010,000, 59,720,011,000) 4.000 KiB |* | + total size: 62.000 GiB + +DAMON found two distinct 4 KiB regions that pretty hot. The regions are a= lso +well aged. The hottest 4 KiB region was keeping the access frequency for = about +8 minutes, and the coldest region was keeping no access for about 7 minute= s. +The distribution on the histogram also looks like having a pattern. + +Especially, the finding of the 4 KiB regions among the 62 GiB total memory +shows DAMON=E2=80=99s adaptive regions adjustment is working as designed. + +Still the number of regions is close to the ``min_nr_regions``, and sizes = of +cold regions are similar, though. Apparently it is improved, but it still= has +rooms to improve. + +400ms/8s intervals: Pretty Improved Results +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Increase the intervals four times (400 milliseconds and 8 seconds +for sampling and aggregation intervals, respectively). :: + + # damo start -s 400ms -a 8s + # sleep 600 + # damo record --snapshot 0 1 + # damo stop + # damo report access --sort_regions_by temperature + 0 addr 64.492 GiB size 1.508 GiB access 0 % age 6 m 48 s # = coldest + 1 addr 21.749 GiB size 5.674 GiB access 0 % age 6 m 8 s + 2 addr 27.422 GiB size 5.801 GiB access 0 % age 6 m + 3 addr 49.431 GiB size 8.675 GiB access 0 % age 5 m 28 s + 4 addr 33.223 GiB size 5.645 GiB access 0 % age 5 m 12 s + 5 addr 58.321 GiB size 6.170 GiB access 0 % age 5 m 4 s + [...] + 25 addr 6.615 GiB size 297.531 MiB access 15 % age 0 ns + 26 addr 9.513 GiB size 12.000 KiB access 20 % age 0 ns + 27 addr 9.511 GiB size 108.000 KiB access 25 % age 0 ns + 28 addr 9.513 GiB size 20.000 KiB access 25 % age 0 ns + 29 addr 9.511 GiB size 12.000 KiB access 30 % age 0 ns + 30 addr 9.520 GiB size 4.000 KiB access 40 % age 0 ns + [...] + 41 addr 9.520 GiB size 4.000 KiB access 80 % age 56 s + 42 addr 9.511 GiB size 12.000 KiB access 100 % age 6 m 16 s + 43 addr 58.321 GiB size 4.000 KiB access 100 % age 6 m 24 s + 44 addr 9.512 GiB size 4.000 KiB access 100 % age 6 m 48 s + 45 addr 58.106 GiB size 4.000 KiB access 100 % age 6 m 48 s # = hottest + total size: 62.000 GiB + # damo report access --style temperature-sz-hist + + [-40,800,000,000, -32,639,999,000) 21.657 GiB |********************| + [-32,639,999,000, -24,479,998,000) 17.938 GiB |***************** | + [-24,479,998,000, -16,319,997,000) 16.885 GiB |**************** | + [-16,319,997,000, -8,159,996,000) 586.879 MiB |* | + [-8,159,996,000, 5,000) 4.946 GiB |***** | + [5,000, 8,160,006,000) 260.000 KiB |* | + [8,160,006,000, 16,320,007,000) 0 B | | + [16,320,007,000, 24,480,008,000) 0 B | | + [24,480,008,000, 32,640,009,000) 0 B | | + [32,640,009,000, 40,800,010,000) 16.000 KiB |* | + [40,800,010,000, 48,960,011,000) 8.000 KiB |* | + total size: 62.000 GiB + +The number of regions having different access patterns has significantly +increased. Size of each region is also more varied. Total size of non-zero +access frequency regions is also significantly increased. Maybe this is al= ready +good enough to make some meaningful memory management efficieny changes. + +800ms/16s intervals: Another bias +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D + +Further double the intervals (800 milliseconds and 16 seconds for sampling +and aggregation intervals, respectively). The results is more improved fo= r the +hot regions detection, but starts looking degrading cold regions detection= . :: + + # damo start -s 800ms -a 16s + # sleep 600 + # damo record --snapshot 0 1 + # damo stop + # damo report access --sort_regions_by temperature + 0 addr 64.781 GiB size 1.219 GiB access 0 % age 4 m 48 s + 1 addr 24.505 GiB size 2.475 GiB access 0 % age 4 m 16 s + 2 addr 26.980 GiB size 504.273 MiB access 0 % age 4 m + 3 addr 29.443 GiB size 2.462 GiB access 0 % age 4 m + 4 addr 37.264 GiB size 5.645 GiB access 0 % age 4 m + 5 addr 31.905 GiB size 5.359 GiB access 0 % age 3 m 44 s + [...] + 20 addr 8.711 GiB size 40.000 KiB access 5 % age 2 m 40 s + 21 addr 27.473 GiB size 1.970 GiB access 5 % age 4 m + 22 addr 48.185 GiB size 4.625 GiB access 5 % age 4 m + 23 addr 47.304 GiB size 902.117 MiB access 10 % age 4 m + 24 addr 8.711 GiB size 4.000 KiB access 100 % age 4 m + 25 addr 20.793 GiB size 3.713 GiB access 5 % age 4 m 16 s + 26 addr 8.773 GiB size 4.000 KiB access 100 % age 4 m 16 s + total size: 62.000 GiB + # damo report access --style temperature-sz-hist + + [-28,800,000,000, -23,359,999,000) 12.294 GiB |***************** | + [-23,359,999,000, -17,919,998,000) 9.753 GiB |************* | + [-17,919,998,000, -12,479,997,000) 15.131 GiB |********************| + [-12,479,997,000, -7,039,996,000) 0 B | | + [-7,039,996,000, -1,599,995,000) 7.506 GiB |********** | + [-1,599,995,000, 3,840,006,000) 6.127 GiB |********* | + [3,840,006,000, 9,280,007,000) 0 B | | + [9,280,007,000, 14,720,008,000) 136.000 KiB |* | + [14,720,008,000, 20,160,009,000) 40.000 KiB |* | + [20,160,009,000, 25,600,010,000) 11.188 GiB |*************** | + [25,600,010,000, 31,040,011,000) 4.000 KiB |* | + total size: 62.000 GiB + +It found more non-zero access frequency regions. The number of regions is = still +much higher than the ``min_nr_regions``, but it is reduced from that of the +previous setup. And apparently the distribution seems bit biased to hot +regions. + +Conclusion +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +With the above experimental tuning results, we can conclude the theory and= the +guide makes sense to at least this workload, and could be applied to simil= ar +cases. --=20 2.39.5 From nobody Thu Feb 12 23:02:20 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E48231B6CF6; Thu, 2 Jan 2025 19:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844510; cv=none; b=E8nRu4ph2v80AoX9UMrtZZh9HlOy3ILz9hkEPVAmuRl8iDSgRN4gvbSBjmwGHfmMLMyc12IiOze0XmANuD1d0AG/gbz6o8BQsfa5ssIrNw7d+pLD13j9pLOvss72SWKr2aFCM5wKU5g/BSrWiMLSvpKBT9fXimWrl7IomTzZcxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844510; c=relaxed/simple; bh=UnJyVIKRtYQAQG2EpBsfZO/49jup78sa4mglOLthEos=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=gif2RXu3lb9Be/kJJebAh/7RKQi2dQeY1gsLrxK+sg6/hViTBnvBJH76yTUqYSHu4qNokRD1UQGkg2k7zlbd2xJCyfmm1/I762KykukI6y3RPUAMEG0Abb2ZKwfHxkdilfB1oZCK7+Gf0Lyo6VKum0WjcQUWOuj2GWi4HJUuwOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZgEmnE9M; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZgEmnE9M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 171AAC4CEE4; Thu, 2 Jan 2025 19:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735844509; bh=UnJyVIKRtYQAQG2EpBsfZO/49jup78sa4mglOLthEos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZgEmnE9Mp+px/eZdPFF6nYV98HWNhak7ZEWvExNSAZWSqNJz++d1+QOARODg/hjtD kRyHquK5TdesMpSfbHw6gR46FsyYN+shjdMQV7QM+OFKh4qYmYkd8mKlIEV7GavxNM GiGbZiLU7z70TNxyqLu/K95kYCo5HAfOOKoGDgONllRE8KZsrPUUygBRk/2+wF0fxk CcmeP1z4hxLeeRyXwNaOvbr7UAPLr7M5ZlXin/3I0RHGA0EZj2RGDFAsIIzLdlb8qX aA2oNPHrlxRui+fJ7FmDiqZRiZWsF1hgOjQxBJZvO7J4PO1YjhcmWuVqi1eSSMId+Y PlaDp0WA9gSIg== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 3/5] Docs/admin-guide/mm/damon/usage: fix and add missing DAMOS filter sysfs files on files hierarchy Date: Thu, 2 Jan 2025 11:01:36 -0800 Message-Id: <20250102190138.47258-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250102190138.47258-1-sj@kernel.org> References: <20250102190138.47258-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DAMON sysfs files hierarchy on DAMON usage document is wrong about DAMOS filter directory. The directory has 'memcg_path' file, but it wrongly describes the name as 'memcg_id'. Also the directory has 'addr_start', 'addr_end', and 'target_idx' files, but missing those. Fix the wrong name and add missed files. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/a= dmin-guide/mm/damon/usage.rst index ab343d6ac771..022f72cf5e14 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -89,7 +89,7 @@ comma (","). =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 0/target_metric,target_value,current_value =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`watermarks `/metric,interval_us,high,mid,low =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`filters `/nr_filters - =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 0/type,matching,memcg_id,pass + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 0/type,matching,pass,memcg_path,addr_start,addr_end,target_idx =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`stats `/nr_tried,sz_tried,nr_applied,sz_applied,= sz_ops_filter_passed,qt_exceeds =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`tried_regions `/total_bytes =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 0/start,end,nr_accesses,age,sz_filter_passed --=20 2.39.5 From nobody Thu Feb 12 23:02:20 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B50381B6D1F; Thu, 2 Jan 2025 19:01:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844510; cv=none; b=OVKKA5CIryG864/jiXexBZPqpp64vdCnBBqqsPe4gIGfYhn9PecRhHJtBOum+kTv4wdS4zJ7p3livlleRApCcjxCCt9OpE4D1SyPZQj0jM/clvl1Ebqf91DmQBDtUmsaA+l4Ix8T8YAWuo98gGT3pn1Gr0g24kSVohh2DH0RjSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844510; c=relaxed/simple; bh=aWAtO/ukWuo+Gw+e1jsTvL0mxpCCcaLZzb38C60eEgY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SZ7yDgbI/h3uDR4K9t1fGhQigdJKBKK+AShttULvWSN2hZbvsukgMWj9OCJCZ5pE9Ii/1QLD4Nlun2HWLM6DzekcYHadweGmmBfoYzY7MTcv6aF8NeZf2LVLKmWEKp6OKPzReUwc3lDaBBZ6MS838hGPCmGwCWZzOJYtbhYEmgI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nnu/jGrb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nnu/jGrb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 199EAC4CED0; Thu, 2 Jan 2025 19:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735844510; bh=aWAtO/ukWuo+Gw+e1jsTvL0mxpCCcaLZzb38C60eEgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnu/jGrbpuhadcwOnHRbzxn0EStgfKpQid5p2XQm3f1ageFh1KPxqlmR0bShY0i3+ HlbaWJyNJ7fKIB1OulkK6Hq9HfPLQZxpFtDFtOn4RsqkkBZzpLPk6p0FmlRcNzmKP3 Uepoo1sTpBVhZSNFVtQPbd3cD6V9DLl1OWs/rAwezKWPX8LW7DtwDiGdZbWYXhhVP5 IJ4iZmX/W8b4NP21naNNJTYBnbBVgXr9rayGPlyosMvpsF7uOiwj5/0N8Bf1+A6Ta5 of7y5RSiUFzkZClAmb4HJFI3xHcTTQnzLEj44zYoBN4hYZ1iVJPPZdDIulovSkdaau 12aTN3H48Rllg== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 4/5] Docs/admin-guide/mm/damon/start: update snapshot example Date: Thu, 2 Jan 2025 11:01:37 -0800 Message-Id: <20250102190138.47258-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250102190138.47258-1-sj@kernel.org> References: <20250102190138.47258-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Two of DAMON user-space tool (damo) commands that are used for examples on DAMON getting started document, namely 'damo show' and 'damo report heats' are deprecated[1,2], and replaced by new commands that provides same functions with a simplified user interface. Also the example output of 'damo show' is outdasted. 'damo schemes' command is not deprecated, but users are recommended to use 'damo start' instead. Update the examples to use the replacements, recommdnations, and up-to-date output formats. [1] https://git.kernel.org/sj/damo/c/3272e0ac94ecc5e1 [2] https://git.kernel.org/sj/damo/c/da3ec66bbdd9e87d Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/start.rst | 67 ++++++++++++-------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/start.rst b/Documentation/a= dmin-guide/mm/damon/start.rst index c4dddf6733cd..ede14b679d02 100644 --- a/Documentation/admin-guide/mm/damon/start.rst +++ b/Documentation/admin-guide/mm/damon/start.rst @@ -42,32 +42,45 @@ the execution. :: =20 $ 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 50= 0 ms - 4 addr [127.649 TiB , 127.649 TiB) (9.535 MiB ) access 100 % age 30= 0 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 10= 0 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 + $ sudo damo report access + heatmap: 641111111000000000000000000000000000000000000000000000[...]33= 333333333333335557984444[...]7 + # min/max temperatures: -1,840,000,000, 370,010,000, column size: 3.92= 5 MiB + 0 addr 86.182 TiB size 8.000 KiB access 0 % age 14.900 s + 1 addr 86.182 TiB size 8.000 KiB access 60 % age 0 ns + 2 addr 86.182 TiB size 3.422 MiB access 0 % age 4.100 s + 3 addr 86.182 TiB size 2.004 MiB access 95 % age 2.200 s + 4 addr 86.182 TiB size 29.688 MiB access 0 % age 14.100 s + 5 addr 86.182 TiB size 29.516 MiB access 0 % age 16.700 s + 6 addr 86.182 TiB size 29.633 MiB access 0 % age 17.900 s + 7 addr 86.182 TiB size 117.652 MiB access 0 % age 18.400 s + 8 addr 126.990 TiB size 62.332 MiB access 0 % age 9.500 s + 9 addr 126.990 TiB size 13.980 MiB access 0 % age 5.200 s + 10 addr 126.990 TiB size 9.539 MiB access 100 % age 3.700 s + 11 addr 126.990 TiB size 16.098 MiB access 0 % age 6.400 s + 12 addr 127.987 TiB size 132.000 KiB access 0 % age 2.900 s + total size: 314.008 MiB + $ sudo damo stop =20 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 t= ime -(``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. +to start the program via the given command and make DAMON monitors the new= ly +started process. The third command retrieves the current snapshot of the +monitored access pattern of the process from DAMON and shows the pattern i= n a +human readable format. + +The first line of the output shows the relative access temperature (hotnes= s) of +the regions in a single row hetmap format. Each column on the heatmap +represents regions of same size on the monitored virtual address space. T= he +position of the colun on the row and the number on the column represents t= he +relative location and access temperature of the region. ``[...]`` means +unmapped huge regions on the virtual address spaces. The second line shows +additional information for better understanding the heatmap. + +Each line of the output from the third line shows which virtual address ra= nge +(``addr XX size XX``) of the process is how frequently (``access XX %``) +accessed for how long time (``age XX``). For example, the evelenth region= of +~9.5 MiB size is being most frequently accessed for last 3.7 seconds. Fin= ally, +the fourth command stops DAMON. =20 Note that DAMON can monitor not only virtual address spaces but multiple t= ypes of address spaces including the physical address space. @@ -95,7 +108,7 @@ Visualizing Recorded Patterns You can visualize the pattern in a heatmap, showing which memory region (x-axis) got accessed when (y-axis) and how frequently (number).:: =20 - $ sudo damo report heats --heatmap stdout + $ sudo damo report heatmap 2222222222222222222222222222222222222221111111111111111111111111111111= 1111111100 4444444444444444444444444444444444444443444444444444444444444444444444= 4444443200 4444444444444444444444444444444444444443344444444444444444444444444444= 4444444200 @@ -160,6 +173,6 @@ Data Access Pattern Aware Memory Management Below command makes every memory region of size >=3D4K that has not access= ed for >=3D60 seconds in your workload to be swapped out. :: =20 - $ sudo damo schemes --damos_access_rate 0 0 --damos_sz_region 4K max \ - --damos_age 60s max --damos_action pageout \ - + $ sudo damo start --damos_access_rate 0 0 --damos_sz_region 4K max \ + --damos_age 60s max --damos_action pageout \ + --=20 2.39.5 From nobody Thu Feb 12 23:02:20 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E24F51B6D0D; Thu, 2 Jan 2025 19:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844512; cv=none; b=tfpK6E6q12TG59vh3eyzJo0KffwkBBfg14qfP9UaHw61sYF0eeT6Fo+r0322GjNCwWYa3BoEP+hpjZRr9HGQO3L8SrC/w0dSqKmF4WTcghoOkguXLMP+n9HKl8xbK+Ao0wYzGyOWdoiNbwCu4gLZe2EAGeN/CcgC4xxasPkQrl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844512; c=relaxed/simple; bh=Y1NV3w3Fvk/peP/cJXxwGprVnmhKsS9FZwzyPyCKXNY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RkOuyxYLp+UXlrQo83Urf8mCAATC0s1o55dNjcRr9uMARoJH3jku2S0Y+0BciYkbtt6NXC3XYWRBVs52rdAsVDp/Pmrpjq05DWG6Cex66GiaTM6CkLKZ1bmtgSt4BRFdMtTNoDQzRdOEA2+HcebfxEigVVZH1ISFQDdI7k3e2xI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XlaCOO5r; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XlaCOO5r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18B1CC4CED0; Thu, 2 Jan 2025 19:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735844511; bh=Y1NV3w3Fvk/peP/cJXxwGprVnmhKsS9FZwzyPyCKXNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XlaCOO5rNn19HvIkCUNx1ojxpPoXV5gCSrJ79URuhc4SthOwBVX5GaPmmpbfCBST9 4wzNVnBEI+1lU5WNwV0TYHnnBEvI90xXCEblFhyjxNJqFNW6fDzuu+eE3x9EpFc3TT do8fW2RPtllMT+6IcYVaJI67yPSps96ROFY86k43IksroZBefuUqgjLsZJ/84FNuEL +ei8vdF1xdhTyHSB8cpemAx+l2y520q8yUFhSx8ZN2Gwpvh0tJtKrQ30jKphByKXZf vz5wR5xA5N2ICq5J6T3Kvj91ikIIGgxDGCV+Yq548AZhl6Ri7d4J3AuyElYT2SaoyN RvhJzPmVpbgbQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yunjeong Mun , Honggyu Kim Subject: [RFC PATCH 5/5] mm/damon: explain "effective quota" on kernel-doc comment Date: Thu, 2 Jan 2025 11:01:38 -0800 Message-Id: <20250102190138.47258-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250102190138.47258-1-sj@kernel.org> References: <20250102190138.47258-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The kernel-doc comment for 'struct damos_quota' describes how "effective quota" is calculated, but does not explain what it is. Actually there was an input[1] about it. Add the explanation on the comment. Also, fix a trivial typo on the comment block: s/empt/empty/ [1] https://github.com/damonitor/damo/issues/17#issuecomment-2497525043 Cc: Yunjeong Mun Cc: Honggyu Kim Suggested-by: Honggyu Kim Signed-off-by: SeongJae Park --- Changes from single-RFC (https://lore.kernel.org/20241126002921.50035-1-sj@kernel.org) - fix a typo and grammartical error (Honggyu Kim) - Integrate into this patch series include/linux/damon.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index ad0360711aca..ce477a0ed6a2 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -193,11 +193,16 @@ struct damos_quota_goal { * size quota is set, DAMON tries to apply the action only up to &sz bytes * within &reset_interval. * - * Internally, the time quota is transformed to a size quota using estimat= ed - * throughput of the scheme's action. DAMON then compares it against &sz = and - * uses smaller one as the effective quota. + * To convince the different types of quotas and goals, DAMON internally + * converts those into one single size quota called "effective quota". DA= MON + * internally uses it as the only one real quota. The conversion is made = as + * follows. * - * If @goals is not empt, DAMON calculates yet another size quota based on= the + * The time quota is transformed to a size quota using estimated throughpu= t of + * the scheme's action. DAMON then compares it against &sz and uses small= er + * one as the effective quota. + * + * If @goals is not empty, DAMON calculates yet another size quota based o= n the * goals using its internal feedback loop algorithm, for every @reset_inte= rval. * Then, if the new size quota is smaller than the effective quota, it use= s the * new size quota as the effective quota. --=20 2.39.5