From nobody Sat Feb 7 21:14:41 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 A51F824B22A; Fri, 10 Jan 2025 18:52:41 +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=1736535161; cv=none; b=CBG/v9sLKEvBMicVW+MEmaLOtMlYLA8Fwliaqm7QZFvGxMuwuTJspysAummi2P6nDyuKsBdHx8sqAvUxg42wveOX8SWMxB9nwYz/PE0wyxa91AoS+xEjQrODRSYlIfImfHZGqLgq0OdHO7B73LyzYfJbFVZ5K4ICaRZ6qJdB+js= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736535161; c=relaxed/simple; bh=OhiJLdYW/SZA1DPs4LYjgcwHYXKVNp0i99jYURYdR3o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NwRbfqXVJCfiXSOXhgd6mIjkTVwHlxTm/thm8HsL7kROKFgOVcSJzoB1J9lzkWgVA3BpBXxaYlzHthMIINr26i4R0WbVmJdcQNvzmgMB927ydtYsgLYO4Bzo2veFUXeVm+Ro8WaHINOVc9HXEwvHjDeprlXIcc7zWbNjEnHvcUI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JSdkNg38; 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="JSdkNg38" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D497C4CED6; Fri, 10 Jan 2025 18:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736535161; bh=OhiJLdYW/SZA1DPs4LYjgcwHYXKVNp0i99jYURYdR3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSdkNg38oRiYAiL0Y2handSc2PdlVRbvyiaLZ/O+joMpFP6bCxqOTZdMJ5SG+GfrO XfzJamDF8rQnvYjJ7D4HltWOKGUCIb66WUyFp1oKFt0Mo8+zKE/r8llSzwzu+YKsb0 RFoHWE5V76uFUCn9zWR/t82ufSz3FeHDOM++OkbOqaGIFMsPR+ed2OrVTbf57+TTEI CWlLTHtOo+skOX/YkTP2g8cfRkhhFJf0B5SULirlOaBuF4JPmJK/Lr9zO2Drl+4sse UwQSQwpxXb4D7Z8VGFofM64eHuOQi7Opdm5hKv9kSJgEFbCn2ioMowaXfoeoX2NbwO iwTc+D67NdTow== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/5] Docs/mm/damon/design: add monitoring parameters tuning guide Date: Fri, 10 Jan 2025 10:52:28 -0800 Message-Id: <20250110185232.54907-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110185232.54907-1-sj@kernel.org> References: <20250110185232.54907-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 should be tuned 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] at best, or made people forgive DAMON without tuning. 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 667775bab86c..dd7e0f63a69a 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 Sat Feb 7 21:14:41 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 E835E24B256; Fri, 10 Jan 2025 18:52:42 +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=1736535163; cv=none; b=TWomyx6TqEFnN8P0nMwJNkqxeWHhvvqRSv520iNBTLS32QYpJXD8Sk22wAPH63k2Jo6ACo5h42e2DW3Vvh0z4MwwBWRcffat0qMJ0lVrKYB7Uj54OhKe91NP9nAa6GndB4AU6EwOY12CfT3i9f9J7WL0PuJKXdvYMpEro9X4jXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736535163; c=relaxed/simple; bh=5Klw8hhvSx8PwTI5/pAo/3RzEAQ8x9KUOdqUhdvSuAA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=m/IIiEhl50d4g+6m/qtvLfLQkpShUtGxgRyFqg424jlsWiiCmHDNHG0XIHPUI49VMg83xmaKrPoXErNrQ3yAcp3pFNoalqOct0LAUs19mTBfCbkHq7SV138/Ca1qFmj2Y8M9vJF+OkvEc77MS0e6h5qafAzemm385uEPtsGDx2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C/7tOLDx; 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="C/7tOLDx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BC5DC4CED6; Fri, 10 Jan 2025 18:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736535162; bh=5Klw8hhvSx8PwTI5/pAo/3RzEAQ8x9KUOdqUhdvSuAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/7tOLDxElbvtd88mHf2oqtpr6svMq043nME7utrlnA4j1Ty+czFMhdc3WHsgcoKK SM5CyK6FehUEStF2WgXnmS1rG2T4M93lUwNFcJV6TWD8SayQ2EEvvOrvXBiPcKUP4J SjH9h5wnZoVMNtk7qX6NscgHVmpr49MAYf3bLTkEBEskSmaGudQ9Q+ge6ZbvV1MDOK Y6E6pMJ2ofopymHf0b9nBmCiBAAPHYb7koCCxIUBmMUfoXLAp/tj4AssOZZsZcmRzd fydwnCWh5buqFh0nLiKxK2i9/GVNYwOy2ntM9G9GFURRwlahna8vSd4+R2DWlDD4qz AElWBPz8oeYfg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/5] Docs/mm/damon: add an example monitoring intervals tuning Date: Fri, 10 Jan 2025 10:52:29 -0800 Message-Id: <20250110185232.54907-3-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110185232.54907-1-sj@kernel.org> References: <20250110185232.54907-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 contains output from a demonstration of the guide on a real server workload system. The example with real world numbers will help users better understanding the guide instructions and what outputs they can expect and verify. Those will again help finding the rooms for improvements 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 dd7e0f63a69a..e28c6a1b40ae 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 Sat Feb 7 21:14:41 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 E67CF212D94; Fri, 10 Jan 2025 18:52:43 +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=1736535164; cv=none; b=CKfnLiYCJG2QiYI5MqQZKoFZRNYTiSVnX+xUQ3zPMSvk+1BMrH/Vdj88RNgX2gkwnTxKmRq4F/zMHEI0AgvIivjDVxct5MVXcyhaXClPsVFVRzKEXqtVwqSCWK6+FSkprAg7LrwFxkJRIE4VMAN7S913z/jiXr1AwEXmBCyC90s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736535164; c=relaxed/simple; bh=aQ+Bj2xTqVO3IMkQIcaZrOE0PN1bTM2On8Eb95tnIgI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=KRFGaShJJGWCzp4T2wqJ5nz+zIzfcH2n80EGZ5NqTIMvw5evGmt+PQO79d2slIu7kRNQUyiJ25hws7Hi6xA3NRNhDr8HHg0mJznc9NYEnmPgBojy2kDQKJtjlJxdB0w+7AmQSttdTtZm2LfiKS0PEmLTr7FNaKf6WL/xvIVweLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CZOUza/j; 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="CZOUza/j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62E3DC4CED6; Fri, 10 Jan 2025 18:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736535163; bh=aQ+Bj2xTqVO3IMkQIcaZrOE0PN1bTM2On8Eb95tnIgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CZOUza/juB/9t158ZUTYhyyXOlW+YWK8xda7ymc4LKhaB9KtBHAivnNhE7IxMe5Yn 9lbrtz83aZRFa8hkMUDOPbHyK57Liq/PQqHumsTR5FHTEfHKC0BcGZ3pJM94WmNYRY 3Zxm61uBPNoIaxDaNwc7CsldDmTTxPmwv8Qe1MCZERKqvLni4ANNMfHA5NmD8Y4gU1 CUCbCYeSJ5f4TMVDJll6uW1pX5XDTXCkf/Td+PWgsh+KebQWF2zhUmYEvo639aHdwB PGFOyk7yPoFaO9OUaeC2rdsdfezAzUY2xOxQAteQKMTG60YshYar4DwD563v+OF4kt dveLIVntFFbOA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/5] Docs/admin-guide/mm/damon/usage: fix and add missing DAMOS filter sysfs files on files hierarchy Date: Fri, 10 Jan 2025 10:52:30 -0800 Message-Id: <20250110185232.54907-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110185232.54907-1-sj@kernel.org> References: <20250110185232.54907-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 DAMOS filter directory part of DAMON sysfs files hierarchy on the usage document is wrong. 'memcg_path' file under the directory is wrongly written as 'memcg_id'. Also the directory has 'addr_start', 'addr_end', and 'target_idx' files, but the list is missing those. Fix the wrong name and add missing 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 f0d0c20711d6..47a44bd348ab 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -83,7 +83,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,allow + =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,allow,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 Sat Feb 7 21:14:41 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 105B0215058; Fri, 10 Jan 2025 18:52:44 +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=1736535165; cv=none; b=L5ubWgiCpHLYn/5rMFfmrek/HYRPhPFu3Ujm6rKR0mpgbvd37ILRcWxMBgaTYvTZG4w0LFKd4HcMVz7E2+MaTSePJkLIhb1yThcK9ztNcVKIakCUyeMm/JWUp4wZImVTHe2L+FxAp6c+fxWW7FpI2jYHwHwY0+VbSOKG1mC16Ac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736535165; c=relaxed/simple; bh=ew5XgI3zhdST5X2UaL5ouhohLppujWeUu4n87xwMgTs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LQ3KAJzZGVUCnHZ/zH+ipT9R9Vtig1Jdh1bW3P/ZtyQDtyyUfeHB23c+zAFQykwwsbm9IcO0vTiyrS55Uzf9Ubu7MXJaBLztBGIwrtAT96DH2kUL/cfEpM2/ju+MQz8K/rh1y6ArmRs6W4b6Qin371h+9ZFC39HqgP8sc1Knaf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lMNKBENO; 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="lMNKBENO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78C0EC4CED6; Fri, 10 Jan 2025 18:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736535164; bh=ew5XgI3zhdST5X2UaL5ouhohLppujWeUu4n87xwMgTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lMNKBENOmMQzlS+PAUYCNfYlNbOmaFYkeYcwNC3a6R18W7BN6tuZJBOqu0SpfjYKo pq0OwD4oZqBYWcENh+fgMWlWwbHxAe6diuDG/DE5UI7VNxS5U5lePu8X13ZtVHCCiT xhA+/EZdpAWjLjWHsHQFIIHkBKRowHFq6lwhpq/2ZhS/Q30SeL7hgB3kf31yPCVYxB yIWOmS/seNziAb6R9XN+SGFRXJTujhH0IS9PJrdhtTNMZswONEludKyEvJjBxi/h/0 DGqlbBU6TqWzOupor6LhgMiedHBCRNCRegZMl+iemLT/yKtv+snuFl9GHFjoWANDlU U7rpWdkkCsH0g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Jonathan Corbet , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/5] Docs/admin-guide/mm/damon/start: update snapshot example Date: Fri, 10 Jan 2025 10:52:31 -0800 Message-Id: <20250110185232.54907-5-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110185232.54907-1-sj@kernel.org> References: <20250110185232.54907-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 unified and simplified user interfaces. Also the example output of 'damo show' is outdated. 'damo schemes' command is not deprecated, but users are recommended to use 'damo start' or 'damo tune' 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 Sat Feb 7 21:14:41 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 43BEF222587; Fri, 10 Jan 2025 18:52:45 +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=1736535166; cv=none; b=E6XRvf8fTRekXRDrZJHzOVby3ooN1t44cnGxRw8sZ4L69xcOBxhiXefAI7w7HHKQehXvF/uWBLh4mzh4mVMP/qrSEgEuRFmN2oV5jg0VXFPCYRelv91Mca2eHs5HwumQk9NCj4DHAz9WqbD3sf0ftv1gCQB+X4VrgZNBanxnMN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736535166; c=relaxed/simple; bh=cNUCy0TlSD/d2Pmdsrm3XmKc2hpQgSkhrpqQ3/ahDso=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GDxhbC5552zpeOezx2RQOkw4muSfg8NdpnWM6PMEO22HCFpmCNA0dqC+7wtEFJigkniJiJKnhEbE1F9ozEGSzPZOK+NiSu0Dg1zECn/Clg1LwYtIkYwqUzd0d0vmFRU01V9yZY+d8Tk+P9L6MhChM3vMO/YXW9WxUeUaS9jranQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nOJStIW3; 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="nOJStIW3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E14BC4CED6; Fri, 10 Jan 2025 18:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736535165; bh=cNUCy0TlSD/d2Pmdsrm3XmKc2hpQgSkhrpqQ3/ahDso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nOJStIW36CNd5fyaROhH7XAA105UoPMXTv3X5+3gEdRxdL8roGa7Udmi7qjQ091Vh 10qDvazBoYzxsVrclJ/LLeGyN5fLO6pW/zOd3W9bZ8BXBLdw5qitUDZIKi9w0ydLZS 5u8jraLrBtSVYRe87G2EB0o28LyTX7sqb3hUNfVBJDYUFiAORjeQKEu0OG0wwXHmyv 0A7iUOtXZZMhDLQym8FXdIRcj2XKwQi+ZvfDC84+gvcn/spWfckXIj8DU5JTvHTyqg kE78jbwpINmyDpsOIudJNDFxrpQHyaZaVnZkNwQkpiLPjjXEIR8CKQ2f8ksWky8oI8 QAkSwCkBs4ooA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yunjeong Mun , Honggyu Kim Subject: [PATCH 5/5] mm/damon: explain "effective quota" on kernel-doc comment Date: Fri, 10 Jan 2025 10:52:32 -0800 Message-Id: <20250110185232.54907-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110185232.54907-1-sj@kernel.org> References: <20250110185232.54907-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 --- 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 0834d7ffcb84..af525252b853 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