From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 AF17C2B9BA for ; Thu, 2 Jul 2026 00:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782951784; cv=none; b=dbQgiE6jP3rvtcUEi76mR0pTxE5oWN/DI9paUxGB5XIxoiWe7eDKhlc3T0xGOX4oXy0c4NJmik9uMyrhxPhVKhFHBUa29i6z8WXn2TEIoBFTzEb8QCC7jsH/9V2nfrK30gSBulCS3c/YR+6ATyxwnTR3vfT+3GtyLK/d79T0N0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782951784; c=relaxed/simple; bh=M9jUIOkCuIz6nPvd9iz9O/b/P19FN6mXdroXO2irPb8=; h=Date:To:From:Subject:Message-Id; b=Tk7U1RvV7vBK0szp06Z5t84LswtZExr6fsYkqL9y61dfqDn2cuRZpJzk6SijyEnoj1qxJ6XwPq++FpH1pAuGRSKbO8me0toghsnbk9J11d2jxbsqLxMpFMnIudm2EHdH3tlsUkMTfieFbYq5wizZ31+uFVEaXfVP8RUXHetrTTQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=TQh4++i8; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="TQh4++i8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D8831F000E9; Thu, 2 Jul 2026 00:23:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1782951783; bh=dBoJv2RuXxChl2ecSnLsW4s+pf4IPA0jw2h/NqNCBmg=; h=Date:To:From:Subject; b=TQh4++i8zqv3RnWyapUkIr/MK6HiXSIoXBRJ0elXaQDUaTqzSDeZgcRr05rVW3BuE 2G9uESETW5pBmT2xCNJEl0QjV9erms5Fo99kmwB2XjhVIHs1+lHRjS/P1HzDEFy/NC QFZehMtPXqjC7/vbBQsJx7VwYx+271zbFCnABahs= Date: Wed, 01 Jul 2026 17:23:02 -0700 To: mm-commits@vger.kernel.org,sj@kernel.org,akpm@linux-foundation.org From: Andrew Morton Subject: + mm-damon-core-always-update-last_nr_accesses-for-intervals-change.patch added to mm-new branch Message-Id: <20260702002303.3D8831F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: mm/damon/core: always update ->last_nr_accesses for intervals change has been added to the -mm mm-new branch. Its filename is mm-damon-core-always-update-last_nr_accesses-for-intervals-change.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-damon-core-always-update-last_nr_accesses-for-intervals-change.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: SJ Park Subject: mm/damon/core: always update ->last_nr_accesses for intervals change Date: Mon, 29 Jun 2026 21:07:56 -0700 Each iteration of kdamond_fn() main loop caches and use the next aggregation time (next_aggregation_sis) because it can be updated in the middle, inside kdamond_call(). If that happens, damon_update_monitoring_result() is called for scaling the access frequency information of each region according to the changed intervals. The function does not update damon_region->last_nr_accesses when it is at the end of the aggregation, because it will anyway be reset after the function is executed, in kdamond_reset_aggregated(). Let's suppose damon_nr_accesses_mvsum() is called with the not yet updated last_nr_accesses. It will use the fresh next_aggregation_sis in the context instead of the cached one, unlike kdamond_fn(). As a result, use of not updated last_nr_acceses with the updated next_aggregation_sis result in returning wrong value. There is no such damon_nr_accesses_nvsum() call at the moment, so this is no problem. It is planned to add such calls, though. Prevent the issue by updating last_nr_accesses always. This adds overhead, but that's fine because the overhead is not big, and it is anyway not a fast path. Link: https://lore.kernel.org/20260630040812.149729-4-sj@kernel.org Signed-off-by: SJ Park Cc: Brendan Higgins Cc: "Masami Hiramatsu (Google)" Cc: Mathieu Desnoyers Cc: Shuah Khan Cc: Steven Rostedt Signed-off-by: Andrew Morton --- mm/damon/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/damon/core.c~mm-damon-core-always-update-last_nr_accesses-for-intervals-change +++ a/mm/damon/core.c @@ -871,6 +871,8 @@ static void damon_update_monitoring_resu struct damon_attrs *old_attrs, struct damon_attrs *new_attrs, bool aggregating) { + r->last_nr_accesses = damon_nr_accesses_for_new_attrs( + r->last_nr_accesses, old_attrs, new_attrs); if (!aggregating) { r->nr_accesses = damon_nr_accesses_for_new_attrs( r->nr_accesses, old_attrs, new_attrs); @@ -882,8 +884,6 @@ static void damon_update_monitoring_resu * interval. In other words, make the status like * kdamond_reset_aggregated() is called. */ - r->last_nr_accesses = damon_nr_accesses_for_new_attrs( - r->last_nr_accesses, old_attrs, new_attrs); r->nr_accesses_bp = r->last_nr_accesses * 10000; r->nr_accesses = 0; } _ Patches currently in -mm which might be from sj@kernel.org are mm-damon-sysfs-schemes-fix-dir-put-orders-in-access_pattern_add_dirs.patch mm-damon-sysfs-schemes-put-stats-for-scheme_add_dirs-internal-error.patch mm-damon-ops-common-handle-extreme-intervals-in-damon_hot_score.patch mm-damon-add-a-kernel-doc-comment-for-damon_ctx-probes.patch mm-damon-add-a-kernel-doc-comment-for-damon_ctx-rnd_state.patch maintainers-s-seongjae-sj.patch samples-damon-wsse-handle-damon_start-failure.patch samples-damon-prcl-handle-damon_start-failure.patch samples-damon-mtier-handle-damon_start-failure.patch samples-damon-mtier-handle-damon_stop-failure.patch samples-damon-wsse-stop-and-free-damon-ctx-when-damon_call-fails.patch samples-damon-prcl-stop-and-free-damon-ctx-when-damon_call-fails.patch mm-damon-sysfs-kobject_del-target-normal-context-and-kdamond-dirs.patch mm-damon-sysfs-kobject_del-region-and-target-error-dirs.patch mm-damon-sysfs-schemes-kobject_del-scheme-dirs.patch mm-damon-sysfs-schemes-kobject_del-scheme-region-dirs.patch mm-damon-sysfs-schemes-kobject_del-scheme-filter-dirs.patch mm-damon-sysfs-schemes-kobject_del-scheme-quota-goal-dirs.patch mm-damon-sysfs-schemes-kobject_del-scheme-action-destination-dirs.patch mm-damon-sysfs-kobject_del-probe-dirs.patch mm-damon-sysfs-kobject_del-probe-filter-dirs.patch mm-damon-sysfs-kobject_del-probe-dirs-in-probes_addd_dir-error-path.patch mm-damon-sysfs-schemes-kobject_del-region-for-populate_region-error.patch docs-mm-damon-design-update-for-damos_quota_node_eligible_mem_bp.patch docs-abi-damon-document-probe-files.patch mm-damon-tests-core-kunit-test-damon_rand.patch selftests-damon-sysfssh-test-multiple-probe-dirs-creation.patch selftests-damon-sysfssh-test-coreops_filters-directories.patch selftests-damon-sysfssh-test-dests-dir.patch selftests-damon-sysfssh-test-all-files-in-quota-goal-dir.patch mm-damon-core-reduce-range-setup-in-damon_commit_target_regions.patch mm-damon-sysfs-split-probe-setup-function-out.patch mm-damon-sysfs-split-out-filters-setup-function.patch mm-damon-sysfs-fix-typos-in-probe_addrm_dirs-s-attr-probe.patch mm-damon-core-introduce-damon_nr_accesses_mvsum.patch mm-damon-tests-core-kunit-test-damon_mvsum.patch mm-damon-core-always-update-last_nr_accesses-for-intervals-change.patch mm-damon-core-handle-unreset-nr_accesses-in-damon_nr_accesses_mvsum.patch mm-damon-core-use-damon_nr_accesses_mvsum-in-__damos_valid_target.patch mm-damon-core-use-damon_nr_accesses_mvsum-for-damos-region-tracing.patch mm-damon-sysfs-schemes-use-damon_nr_accesses_mvsum-for-damo-regions.patch mm-damon-core-remove-damon_warn_fix_nr_accesses_corruption.patch mm-damon-core-remove-damon_verify_reset_aggregated.patch mm-damon-core-remove-damon_verify_merge_regions_of.patch mm-damon-tests-core-kunit-remove-nr_accesses_bp-setup-and-tests.patch selftests-damon-drgn_dump_damon_status-do-not-dump-nr_accesses_bp.patch mm-damon-core-remove-nr_accesses_bp-setups-and-updates.patch mm-damon-core-remove-attrs-param-from-damon_update_region_access_rate.patch mm-damon-paddr-remove-attrs-param-from-__damon_pa_check_access.patch mm-damon-vaddr-remove-attrs-param-from-__damon_va_check_access.patch mm-damon-core-remove-damon_moving_sum-and-its-unit-test.patch mm-damon-core-remove-damon_region-nr_accesses_bp.patch