From mboxrd@z Thu Jan 1 00:00:00 1970 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 55A8743D4EA for ; Tue, 28 Apr 2026 14:48:56 +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=1777387736; cv=none; b=n5FicnwTLIxkAzCMgJOnd3mgzVTGSgFwRZL4L8pMKgIzp8P4NQCsAjEi8fKxoHeNv8oheUAVAXUZp2RAcR+rHQwH6I43MgaHqe069AjPFuovX6PB/t/MlfR7d69gBmDqUpmkog+xQOlWLb/YDmwp2h0TlB097o7Ii99sn6FOkJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777387736; c=relaxed/simple; bh=3jWW0pGwxlb7MkDKMrWEDHqdUkTH3FEcdCupXnirWV8=; h=Date:To:From:Subject:Message-Id; b=IcLKM07hWivf0DkrMudcvZpyd+lTlcWeBb+BR3xx2HNI6aw2Ge7FlPU/kFbgx84608IUaUAYMJUSh0sMQy1rkknKwJAn6hoCiQWoFoor6kDN7IFby24ri/gPC0csspe35W4VDD/THFYq8XcHXm7MCqv5+vPhPXw/2uNackkyjuE= 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=SzCRPZTh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="SzCRPZTh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF35BC2BCAF; Tue, 28 Apr 2026 14:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1777387736; bh=3jWW0pGwxlb7MkDKMrWEDHqdUkTH3FEcdCupXnirWV8=; h=Date:To:From:Subject:From; b=SzCRPZThj92OL2KJw3jSyGp3Z+WfGoC1MCBXnYB8JiGfXAiKQyd6KSlo4rR6dUIua dBy6wbPqw/qG1HC3ux7C1OeyNNOYbMxxxlbiHTXgWejgKrISBDFIPLXBt/5x0q0M19 RL5ZV6YtpVwECPChTGvSwe2MiGzWVKjAaizA7l9c= Date: Tue, 28 Apr 2026 07:48:55 -0700 To: mm-commits@vger.kernel.org,sj@kernel.org,akpm@linux-foundation.org From: Andrew Morton Subject: + mm-damon-core-handle-min_region_sz-remaining-quota-as-empty.patch added to mm-new branch Message-Id: <20260428144855.DF35BC2BCAF@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: handle Subject: mm/damon/core: handle Cc: Brendan Higgins Cc: David Hildenbrand Cc: Jonathan Corbet Cc: Liam R. Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Mike Rapoport Cc: Shuah Khan Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- mm/damon/core.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) --- a/mm/damon/core.c~mm-damon-core-handle-min_region_sz-remaining-quota-as-empty +++ a/mm/damon/core.c @@ -2066,6 +2066,20 @@ static void damos_walk_cancel(struct dam mutex_unlock(&ctx->walk_control_lock); } +static bool damos_quota_is_full(struct damos_quota *quota, + unsigned long min_region_sz) +{ + if (!damos_quota_is_set(quota)) + return false; + if (quota->charged_sz >= quota->esz) + return true; + /* + * DAMOS action is applied per region, so esz - quota->charged_sz < min_region_sz; +} + static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, struct damon_region *r, struct damos *s) { @@ -2123,8 +2137,7 @@ static void damos_apply_scheme(struct da quota->total_charged_ns += timespec64_to_ns(&end) - timespec64_to_ns(&begin); quota->charged_sz += sz; - if (damos_quota_is_set(quota) && - quota->charged_sz >= quota->esz) { + if (damos_quota_is_full(quota, c->min_region_sz)) { quota->charge_target_from = t; quota->charge_addr_from = r->ar.end; } @@ -2152,8 +2165,7 @@ static void damon_do_apply_schemes(struc continue; /* Check the quota */ - if (damos_quota_is_set(quota) && - quota->charged_sz >= quota->esz) + if (damos_quota_is_full(quota, c->min_region_sz)) continue; if (damos_skip_charged_region(t, r, s, c->min_region_sz)) @@ -2602,8 +2614,7 @@ static void damos_adjust_quota(struct da if (!time_in_range_open(jiffies, quota->charged_from, quota->charged_from + msecs_to_jiffies(quota->reset_interval))) { - if (damos_quota_is_set(quota) && - quota->charged_sz >= quota->esz) + if (damos_quota_is_full(quota, c->min_region_sz)) s->stat.qt_exceeds++; quota->total_charged_sz += quota->charged_sz; quota->charged_from = jiffies; _ Patches currently in -mm which might be from sj@kernel.org are mm-damon-sysfs-schemes-call-missing-mem_cgroup_iter_break.patch mm-damon-fix-damos_stat-tracepoint-format-for-sz_applied.patch mm-damon-core-make-charge_addr_from-aware-of-end-address-exclusivity.patch docs-mm-damon-maintainer-profile-add-ai-review-usage-guideline.patch mm-damon-core-introduce-damon_ctx-paused.patch mm-damon-sysfs-add-pause-file-under-context-dir.patch docs-mm-damon-design-update-for-context-pause-resume-feature.patch docs-admin-guide-mm-damon-usage-update-for-pause-file.patch docs-abi-damon-update-for-pause-sysfs-file.patch mm-damon-tests-core-kunit-test-pause-commitment.patch selftests-damon-_damon_sysfs-support-pause-file-staging.patch selftests-damon-drgn_dump_damon_status-dump-pause.patch selftests-damon-sysfspy-check-pause-on-assert_ctx_committed.patch selftests-damon-sysfspy-pause-damon-before-dumping-status.patch mm-damon-core-handle-min_region_sz-remaining-quota-as-empty.patch mm-damon-core-merge-regions-after-applying-damos-schemes.patch mm-damon-core-introduce-failed-region-quota-charge-ratio.patch mm-damon-sysfs-schemes-implement-fail_charge_numdenom-files.patch docs-mm-damon-design-document-fail_charge_numdenom.patch docs-admin-guide-mm-damon-usage-document-fail_charge_numdenom-files.patch docs-abi-damon-document-fail_charge_numdenom.patch mm-damon-tests-core-kunit-test-fail_charge_numdenom-committing.patch selftests-damon-_damon_sysfs-support-failed-region-quota-charge-ratio.patch selftests-damon-drgn_dump_damon_status-support-failed-region-quota-charge-ratio.patch selftests-damon-sysfspy-test-failed-region-quota-charge-ratio.patch