From mboxrd@z Thu Jan 1 00:00:00 1970 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 A7B2EC83F1B for ; Thu, 17 Jul 2025 05:55:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 749366B009F; Thu, 17 Jul 2025 01:54:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 707196B00A5; Thu, 17 Jul 2025 01:54:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E41A6B00A1; Thu, 17 Jul 2025 01:54:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3975B6B009F for ; Thu, 17 Jul 2025 01:54:59 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 90F8F1DA8CE for ; Thu, 17 Jul 2025 05:54:58 +0000 (UTC) X-FDA: 83672693076.04.3D8608D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id EF70E140007 for ; Thu, 17 Jul 2025 05:54:55 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=WRjxqP06; spf=pass (imf09.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=1752731696; 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:references:dkim-signature; bh=nEw/DN89lP7nfFFRi6OwJPFBX8J3srR48h+97psMXeY=; b=ev1KP6OUWqNkeGoNpyLelX+3XHUjA1j8TrO6wLqU03ZR7/lq9MKGpOJS3Jkj/w0zrPOnNt i9X99gzebAQJiOxa43JwZxwr2LkKOskoQ9r0XS1IUwWjEjS6VyUMiwg6U/zOWSgotnCtZi L8oF90gOvcFvF0UOodEOHw8h7p2Xepo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752731696; a=rsa-sha256; cv=none; b=7dbn5EdcuTAl4SgIyERosxc/5cGWJKewPfpnfiu0y3RB/sgyy7/LZAPSuY/TJtoSWU+bM+ Z14Ag7NLB0KRXbX/ofQyFsKENEbcoX7XVCiSxzhDkpNj8GBQdWZ7KNqzBWIvUzZRRdFBKF KQiZDgo+wT4C6DnDW80UrorCHqh4Ojk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=WRjxqP06; spf=pass (imf09.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E127F5C62E0; Thu, 17 Jul 2025 05:54:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65E73C4CEE3; Thu, 17 Jul 2025 05:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752731694; bh=/JfI1qVyIG/Mf+m3KGSDeCWLM3l3Dw85BRzvvsCFvP8=; h=From:To:Cc:Subject:Date:From; b=WRjxqP069KuC7kgVsSGZ2dR9YlzrDggLZKgv+4P0nIYETy0tiMqvYVIOxCBi340ln GhqJ5NjcVFILzKwIpObtuER+Y42TH6pDruYRp402JWY84RZYeBvd2FEQymCyTLHiwy AhHiQe0sz44zXq+BOesQAznSXek3vPDSZ16lJJ23l6N/D76D1F7bq+cD3YRH5baFgQ 2zu49xzI3Yj3bazhZrNLzqvIaiSzfO2Bbgn0TRtDIxJCvSM+pgAHguhcHL8O+BBvNw U1rgEt4rSjJQjsE6Yg1iucrozQtPqPVQbMMWsvZOuhrfkcNSClI9JokzuN42R1jkGT vBc7A/4GtadEQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , 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: [PATCH 0/4] mm/damon/sysfs: support periodic and automated stats update Date: Wed, 16 Jul 2025 22:54:44 -0700 Message-Id: <20250717055448.56976-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EF70E140007 X-Stat-Signature: 8m7wab5rf9nt94cmj1749aa8hpw6xeuj X-Rspam-User: X-Rspamd-Server: rspam07 X-HE-Tag: 1752731695-832692 X-HE-Meta: U2FsdGVkX1/Ddoz9KsLMFdURQFzRIzUjwkRccAWN44cMdE/4HGgwgTOjixvyiYWhB+K2KHv/MY3+AKQzoiYn9Kh2sqKyg0xiWdsOfl3NM/54CbTj4WWdYntTt/MhxxTyl5n8pmpSclxhfr9ees1sO1FWtU5SoLSfG2MewQZveNE6pi9/OO6I/7GU/mN8pDNaRHmGekpUSbEtGAwY2nfjFQ2zOi4SpxVnMjOauHILp/accMiovUvN7wJX5Ijqbl2JKYLTrVCJDYY8p0IiG37cTr33LRUxQkB7n5PQvysys+Lv7v4LySGesRU9UrVQzmDRSKa/1ub2lmJbjSOmnO7UBNSDjGYlU8Z/f7doWqirFefnG/9EOzug/JY5tNa/um6RuY36sbxhV8Vchlv/tNC7iM3E53ZRPITKhFWh41sVg1qo4LPkft2sgwzwL8SqAEv8NEgea9hxvAbgEM4xB5WfFxJ1+9m3viyCdbzr1I8jFt8wWIqmi6RHdUtV79UGHrXXVCm9UaPcZHS+9SZej2BDdNVP6akEm3pSTao85ztW6cr3UpDgdnEYdEwIzwGrHGrmVGwnAjymv9bNA+iNFNulTdQWBv7ntHjWlnjw/CLMrtyc3LrCjOnrANupn9uWaQFSp/NjhiucnlNNfCTziZojhEoAFzCDJsL10600mrT4Nt42bmty/kjKUDIfFTGK+LGCl9FToqyAwzbIrkpJn5XO+N7IzGn5EXR27QaVplQAa1f5FFwSKQPqQPQNAFlmqFdyhL6D3gPWRn9HMvS/cJUIp+BiInFzEzM+yiXHANCKyigViKP8Oe4FnCp5OiBTFi07AKRJojcPRLSS6XN+9gSJ4Aw6gkLTXLGtG3aczpbudhz082Fvs+aoAmZt1lYY6IfpbtcNBnf1BNyeaT+Egs/Y+mChzfMRjQQ0cEZuEuYIpkbth0lKdfZTfj+u7FMbTOtwsKTIgmU0B4Xj/DjeC0d WZ/cilPK 1qIOQxKscDBfJMkpsfWYOH/43k+iO/EzrbTkY4ofH/L1ByAmGSuc2lRlstIwZoT5NsXFKFnDL1O7zCf4Emy5AhCEkGB5+/p6JarStm5tJ5jcyhm61OCwlLnPcBOvHywShJ0Wrl12VKjEKaLOv5bybRtYklG++ayR2RQCcofWFr4jloMjszc6zBaoVvKMrBW8lrik7 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 sysfs interface provides files for reading DAMON internal status including auto-tuned monitoring intervals, DAMOS stats, DAMOS action applied regions, and auto-tuned DAMOS effective quota. Among those, auto-tuned monitoring intervals, DAMOS stats and auto-tuned DAMOS effective quota are essential for common DAMON/S use cases. The content of the files are not automatically updated, though. Users should manually request updates of the contents by writing a special command to 'state' file of each kdamond directory. This interface is good for minimizing overhead, but causes the below problems. First, the usage is cumbersome. This is arguably not a big problem, since the user-space tool (damo) can do this instead of the user. Second, it can be too slow. The update request is not directly handled by the sysfs interface but kdamond thread. And kdamond threads wake up only once per the sampling interval. Hence if sampling interval is not short, each update request could take too long time. The recommended sampling interval setup is asking DAMON to automatically tune it, within a range between 5 milliseconds and 10 seconds. On production systems it is not very rare to have a few seconds sampling interval as a result of the auto-tuning, so this can disturb observing DAMON internal status. Finally, parallel update requests can conflict with each other. When parallel update requests are received, DAMON sysfs interface simply returns -EBUSY to one of the requests. DAMON user-space tool is hence implementing its own backoff mechanism, but this can make the operation even slower. Introduce a new sysfs file, namely refresh_ms, for asking DAMON sysfs interface to repeat the update of the above mentioned essential contents with a user-specified time delay. If non-zero value is written to the file, DAMON sysfs interface does the updates for essential DAMON internal status including auto-tuned monitoring intervals, DAMOS stats, and auto-tuned DAMOS quotas using the user-written value as the time delay. In other words, it is similar to periodically writing 'update_schemes_stats', 'update_schemes_effective_quotas', and 'update_tuned_intervals' keywords to the 'state' file. If zero is written to the file, the automatic refresh is disabled. Changes from RFC (https://lore.kernel.or/20250712204650.155988-1-sj@kernel.org) - Wordsmith cover letter to clarify what are updated SeongJae Park (4): mm/damon/sysfs: implement refresh_ms file under kdamond directory mm/damon/sysfs: implement refresh_ms file internal work Docs/admin-guide/mm/damon/usage: document refresh_ms file Docs/ABI/damon: update for refresh_ms .../ABI/testing/sysfs-kernel-mm-damon | 7 +++ Documentation/admin-guide/mm/damon/usage.rst | 13 ++++- mm/damon/sysfs.c | 58 +++++++++++++++++++ 3 files changed, 75 insertions(+), 3 deletions(-) base-commit: 2951e548fd2e489bdaecf326e1c3d17d4b5663fe -- 2.39.5