From patchwork Mon Jul 1 19:26:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13718582 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 7D3ECC2BD09 for ; Mon, 1 Jul 2024 19:27:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A4B66B0098; Mon, 1 Jul 2024 15:27:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02DA76B00A3; Mon, 1 Jul 2024 15:27:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0FC06B00A5; Mon, 1 Jul 2024 15:27:15 -0400 (EDT) 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 C2FD76B0098 for ; Mon, 1 Jul 2024 15:27:15 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7483AA4201 for ; Mon, 1 Jul 2024 19:27:15 +0000 (UTC) X-FDA: 82292167230.13.13C6288 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf30.hostedemail.com (Postfix) with ESMTP id D80C480017 for ; Mon, 1 Jul 2024 19:27:13 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="iJmT4/Kt"; spf=pass (imf30.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=1719862011; 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=+A1OILW0p0QK58mHsj+s6NFrkZQDq088XKHV9Y+GZc4=; b=iGc9Ezxd5g/qfVfA5nLDEiF9gxkA2XZ/jAte5hmQeD8iLrhx2OLYoHQO3Okg9YK5kQvsjm Y8iUfepNP2oU/L64mcMdBUWLd7d45T2rygQ2qrvurGehq3PqB6NpyKDqlXVjASmEuJE3wM Mk/PhbNwQNaJCBynML0B1CRuweA+GNk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719862011; a=rsa-sha256; cv=none; b=RBBe7cCFRkeWu1tZJsdenPXvYyecBQhrHFagbdNjuKZNphsUf6yJcIXEv7dA9FvzqzhVLn kVBn2vfXcR2US111q0fTKYtwT1KS7NwB/CuyH0JfPimYbtXiLiXeSV/o1/z1h0zX+hcfhV QgPTQtYqR6lUKQ8lhhCoiuGgug6mmkc= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="iJmT4/Kt"; spf=pass (imf30.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id EC9CE61788; Mon, 1 Jul 2024 19:27:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39829C32781; 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=1719862032; bh=CGsIJNsF93bpCTcotGBiz8ijvYyjlCry6EOyClMIOWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJmT4/KtExB1HchWvnqk0eBGAY7JJ7M88fEa6i1fAJPIiGKiejAY8ZPPmGCVMVd2a OWPDvZcD2QLnNIDMnqfH6mKpV7KDeAcu/3K8SJQKAJacI5VfXhghHEeRxJyoDmY7HK ufZQ9v2jitu9+6wlWtOTLHiKt1tV1YT5HAqxBn/j08M0tKlbgkTtMZ5JFs5Qvx4Zqz HYjrihwz2dO1oQIrhZts9riSaCpD6GHTnBU7j4GHxmsVM+NNIP17Ymot8b+8MuEUkF DMVElL3f517SFfSiwomSENdfObwdpxtUHU9Ta0FXm1Hd2qJzH6/Y6PbGZXAi8uSbcU yoZXSguI6zdCQ== 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 2/9] Docs/mm/damon/design: clarify regions merging operation Date: Mon, 1 Jul 2024 12:26:59 -0700 Message-Id: <20240701192706.51415-3-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: zca598bup9w55abr9noyy9iwdato4hcd X-Rspamd-Queue-Id: D80C480017 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719862033-126106 X-HE-Meta: U2FsdGVkX19g7usfBYSo4xSO9h/IIlY/xMyqVDPdkdo/w6WOHUroCgcycjkQzsy2lVUh9gFsGE+J4I+V6HU3lVqmVGaZYXB7NRJRGZkUi2nZY3osOkRLh6LFYNnwiPcXfIbQIHb30/UKB42qIGinsQoBJQeLefsS/cI0YzVwIt3nrMh34xklpIxdCuQKWUtRa7Ipfq4TTy9EZzX8dBewZHAU1vdfK9hZYYMadp7xHsAeCkW8kbeOlriBys05dCs2Izl2sj5jJkQflCiobJF2oo0lfiWLDBXOhDRF9JyNjbI7yObpyn13NSkPeIaqU4rZGNL0AVhaa4KQBe/wBVKASVYMXOzEMuIH0imfc5Mr1KVJlJrPftbGTJd1OvqVrYUC/79cKtIQWJaF6XUqg8twzqzyI5lkYlEAF5IuNkJt+swLDP5bcTnWaKiV8ljDA4BZV978B6mMoimIzOKaBfUzviKCIO5FStlfjKjEa0S3hiXQedOUMdMq0xSVa8cG6va/0i2BYHdz0pAxHhGSwMbwWGC9HYk5X7yxoww275Wci73IC6qtN3SSq4HP91vpSrd/8PNET4g9EKSFupdu64M8wwfqJR1QrsiupBhhWo/OZJFvGITTHpd4ItrUbmmNtz/EJMQF4y3306Vrf0lGJ6XH/CpM3jhRfk2FkFlpYJhDb4fzrQ6JQauDDZrPsqTkpZSebHL7NC4f4MQkC2ko7Bpql9aF7qBNe1JIJFkEowOOBm6RaOwv01N2pTLUyYOvP9CpyZcpZjriIn5IeC8zG/+32SfYNCZGHpEHImd7qmkcCVaKQSYZlg4s3/R9ppu7QsrmbhpuGP34Ha1n0nZ9Q0z1emR9Ik/3TEt4GyqOS6AlG5+H+PdvQz4dg2FAk7Q32oX5cKPS/ndT9teRYCXa5xitLPtLAoBQmYbydwHakrPxu0KdbpkG3ij/Q7bOqrsv5h5NrJe3/SRwv+C8IDSUo73 0PW5Rt7v ZP0HmsLNSm+8EoZ0XEUB6lQ8xdu5O4XQ2N33raJq8gxL22TMkFA5cEE9RfrNA0m2pYvgEWtFqfL6GZjvP6v77A9EvMYxv/T9qBZRYQ7bSKMGsmiUFMTIDHxH2BTgPwJH6Czf+0lI7v4S2r1mfTmHJmaeuJ3ml3+7VTo01AiizSZp30xUpUl1Aux0Lo+tL8NqwVNoWbFtLS8tm4LibmATSboiuC1f/OonIQftwAwDp6CT2F90= 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 design document is not explaining how min_nr_regions limit is kept, and what happens if the number of regions exceeds max_nr_regions. Add more clarification for those. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/design.rst index 6beb245cbb62..fe08a3796e60 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -209,11 +209,18 @@ the data access pattern can be dynamically changed. This will result in low monitoring quality. To keep the assumption as much as possible, DAMON adaptively merges and splits each region based on their access frequency. -For each ``aggregation interval``, it compares the access frequencies of -adjacent regions and merges those if the frequency difference is small. Then, -after it reports and clears the aggregated access frequency of each region, it -splits each region into two or three regions if the total number of regions -will not exceed the user-specified maximum number of regions after the split. +For each ``aggregation interval``, it compares the access frequencies +(``nr_accesses``) of adjacent regions. If the difference is small, and if the +sum of the two regions' sizes is smaller than the size of total regions divided +by the ``minimum number of regions``, DAMON merges the two regions. If the +resulting number of total regions is still higher than ``maximum number of +regions``, it repeats the merging with increasing access frequenceis difference +threshold until the upper-limit of the number of regions is met, or the +threshold becomes higher than possible maximum value (``aggregation interval`` +divided by ``sampling interval``). Then, after it reports and clears the +aggregated access frequency of each region, it splits each region into two or +three regions if the total number of regions will not exceed the user-specified +maximum number of regions after the split. In this way, DAMON provides its best-effort quality and minimal overhead while keeping the bounds users set for their trade-off.