From patchwork Thu Feb 13 01:44:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13972686 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 76BD2C02198 for ; Thu, 13 Feb 2025 01:45:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A78476B009B; Wed, 12 Feb 2025 20:45:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DADA6B009C; Wed, 12 Feb 2025 20:45:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 853E6280001; Wed, 12 Feb 2025 20:45:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5AD096B009B for ; Wed, 12 Feb 2025 20:45:02 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1BF1812164E for ; Thu, 13 Feb 2025 01:45:02 +0000 (UTC) X-FDA: 83113228044.18.81B424E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 67CE81A0008 for ; Thu, 13 Feb 2025 01:45:00 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kyEbhvxt; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739411100; 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=PEsgCe48+LXMdsPQ6GQvggULldaiT/f5nk1JmsO52UU=; b=OMkPe7nxFcvApcyHYOSc8pjw2MPwllUOCOCgZzabIHXgR5o5QaVXN5zef/eQfGU3RlXyBV KCot/aXp/70Sz1obnYQUAkF9mNrxX8pPhE31AhmSkpAYR/6w9Cg3ejw8l326rlA06pI8Sc aQou/b1q1Q9ltPljDHKdhdh7ztl+0o0= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=kyEbhvxt; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739411100; a=rsa-sha256; cv=none; b=0tJ8M4tywO5qFSGmKYJHqeP0EydhHihjg6s+GxOHLlecjfH550LT2F+f476dmD5Ug/ZVuJ 0SihL2hvkYL4gI1AtMPfmWYnrnHICYiB/OGJb7p1IQG4Gxc+rSyTCG3KO6tSB2X17hZ8nI UpKoOv/HDStHun5T5dAZgOdZVndR5nc= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 24A275C635D; Thu, 13 Feb 2025 01:44:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C2F6C4CEE4; Thu, 13 Feb 2025 01:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739411099; bh=0wEx+LJOEK19dZIr4jkJc7A6zYxo+0xSxmNO8FVmzUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyEbhvxtr1t+x2oavCe+QyKXEw8qJ00hlkxy6X/ohrCqozW7BMOb6O6UGLvp98fVO 2VFoA+iIdl40G45gDTTQ0UQ5Z5wOv4hdFTDs4NFUDWOutPm9kdLMBlIQm0pwl5vEhC q0kXajprvSiVDOWE+vf1X/bREANPA3suqYUY3Ao1cUnfYVnqonxt/Rl2ETD+T6PB1s QEt5WwqlGh395DHe0Mo1DsyjwfQestlBl42wPeBgQ0jeWuQZHr9iMiNLPD+HzahW8Q D8immH3lmtEs+0GWWaG9R5Uc+URycBeV8ozvk1LanA8AGH+HTV/sFpXFFfZ66Ecrxb K66CQWoMjq1rA== 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 6/8] Docs/mm/damon/design: document for intervals auto-tuning Date: Wed, 12 Feb 2025 17:44:36 -0800 Message-Id: <20250213014438.145611-7-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250213014438.145611-1-sj@kernel.org> References: <20250213014438.145611-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 67CE81A0008 X-Stat-Signature: 8bbqakjbg3u8owrww3jfkwut619qu6i9 X-HE-Tag: 1739411100-736828 X-HE-Meta: U2FsdGVkX19VpZC6aah/NUHttpbmc6ZXRew6Kx+uEZHUk0fkyf8s3hKjFPoiTJco0Kd1xS5wlkdSNfjr52c9Z+xAr0kAmDoAQ2rkhRnDxdu4W34t9QkBHt6tjKFwDkntthgkAthx7kNW0QZYwrBEuE3B/rWNOeDSTCq7FxwWhCWXBgAIt8VCImDHHiHG0ZXRY1F+GxLE5lylM2BVIaybZG7lmlBRABjLcd5P/u4urj/N4ATA4JEqmIrYcuhbLiSpmVhePJIOkaCd5KokQJNnVKQ2F6NVIWQUG+TYa/4AzFU1rNbqqaJqsQT2twBT9bE2gnZdutnktV7W/T12fNBTMZCPyttIcC82M5nQUhCgX7Bzz4bPVPeG4tY9WX1SAFUsxlpAtbcQ9KfJvGPvysKYP67++XMo1kD+c7I/Nr4NzLwVLBSA6kku8o3ohvSbx0n4dtrc4r2LAPApBHJJ42nxkZsTH2F0Ke+gd6SOczE+fBzgow0wsLuwBECTKruuSfFarI6IONVrEtpLxl3zCKT29tRb3oIJ+PAOMJ5k1gn2d5ccsLxOVjjjrsI4N4i2MLuye3POxcrtV7sJ1aVlxJ2EmV6RAfq9Hgb+4wFCscv2RW+399LNvddHsHzJ1b+fQGkwCKQsCR5Qfo0b1gHTGsPXptoqyhgQrD+gqtnVEmUiItX5c1jFozqZ2rHnpJf6iKNf0/BuvWRBlhQzWcFK8/MV/NLTy9Vg6qGsMBmP0TrpL3ftaSiVzg1hdb7QVaVBkH4CxTQumhyhoJ5W6xofjUAnV0UCunyDTQL7RBndojJN4itRpvaQ1LjLDJR7d8/NZJWWPV+cJYUwsT/CqoXjTFlE3JVvEvUc7GD85Lv2Ab4SjXajZ7GnlL3EPlfVrlMF5Z2gUXXxtHrUPm5zT6A5usr31bepCZLDCDrD9ZsoAmvjGoNKHx829tH1utSwB/D6AHBDh+Z+VLjiryiqv+C6rQQ s2/BzY5o IaUC4PhXE0KGejUXxERSVEY0vdbfpAiummUcBiuXDYUD5+C2MQz7MFPcFxAFaiJ6mKCRYnbVoKNj3s268mCMuqzBu45SACc7xTEIryYfnKsG9l0r64UrvuKEafvi91DsVhrjXvEasYTxWJauoxvb/WZ/36xTf66GeJZpJAnmA1d2rEHM/0MqYvSpCP7d+R8Hfu+bQkn0FqGbxMRXY/3u+n8YhPr1Sr5nzZUTgiF1ig8FDGG0xq8R7NqcSJ1TW0Y/qUZ0AWejSScPq0Wc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000020, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Document DAMON sampling and aggregation intervals auto-tuning design. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index e28c6a1b40ae..c8e906ac3965 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -313,6 +313,10 @@ sufficient for the given purpose, it shouldn't be unnecessarily further lowered. It is recommended to be set proportional to ``aggregation interval``. By default, the ratio is set as ``1/20``, and it is still recommended. +Based on the manual tuning guide, DAMON provides more intuitive knob-based +intervals auto tuning mechanism. Please refer to :ref:`the design document of +the feature ` for detail. + Refer to below documents for an example tuning based on the above guide. .. toctree:: @@ -321,6 +325,36 @@ Refer to below documents for an example tuning based on the above guide. monitoring_intervals_tuning_example +.. _damon_design_monitoring_intervals_autotuning: + +Monitoring Intervals Auto-tuning +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +DAMON provides automatic tuning of the ``sampling interval`` and ``aggregation +interval`` based on the :ref:`the tuning guide idea +`. The tuning mechanism allows +users to set the aimed amount of heats to observe with DAMON within given time +interval. The target can be specified by the user as a ratio of access check +samples that gave positive result to the total samples (``samples_bp``) that +measured within a given number of aggregations (``aggrs``). The mechanism +calculates the ratio of access check samples for ``aggrs`` aggregations, and +increases or decrease the ``sampleing interval`` and ``aggregation interval`` +in same ratio, if the samples ratio is lower or higher than the target, +respectively. The ratio of the intervals change is decided in proportion to +the distance between current samples ratio and the target ratio. + +The user can further set the minimum and maximum ``sampling interval`` that can +be set by the tuning mechanism using two parameters (``min_sample_us`` and +``max_sample_us``). Because the tuning mechanism changes ``sampling interval`` +and ``aggregation interval`` in same ratio always, the minimum and maximum +``aggregation interval`` after each of the tuning changes can automatically set +together. + +The tuning is turned off by default, and need to be set explicitly by the user. +As a rule of thumbs and the Parreto principle, 20% access samples ratio target +is recommended. + + .. _damon_design_damos: Operation Schemes