All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-damon-core-document-damos_commit_dests-failure-semantics.patch added to mm-new branch
@ 2026-03-20 17:50 Andrew Morton
  2026-03-20 17:53 ` Josh Law
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Morton @ 2026-03-20 17:50 UTC (permalink / raw)
  To: mm-commits, sj, akpm, objecting, akpm

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5117 bytes --]


The patch titled
     Subject: mm/damon/core: document damos_commit_dests() failure semantics
has been added to the -mm mm-new branch.  Its filename is
     mm-damon-core-document-damos_commit_dests-failure-semantics.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-document-damos_commit_dests-failure-semantics.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: Josh Law <objecting@objecting.org>
Subject: mm/damon/core: document damos_commit_dests() failure semantics
Date: Fri, 20 Mar 2026 07:36:45 -0700

Add a kernel-doc-like comment to damos_commit_dests() documenting its
allocation failure contract: on -ENOMEM, the destination structure is left
in a partially torn-down state that is safe to deallocate via
damon_destroy_scheme(), but must not be reused for further commits.

This was unclear from the code alone and led to a separate patch [1]
attempting to reset nr_dests on failure.  Make the intended usage explicit
so future readers do not repeat the confusion.

Link: https://lkml.kernel.org/r/20260320143648.91673-1-sj@kernel.org
Link: https://lore.kernel.org/20260318214939.36100-1-objecting@objecting.org [1]
Signed-off-by: Josh Law <objecting@objecting.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/damon/core.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--- a/mm/damon/core.c~mm-damon-core-document-damos_commit_dests-failure-semantics
+++ a/mm/damon/core.c
@@ -1060,6 +1060,23 @@ static void damos_set_filters_default_re
 		damos_filters_default_reject(&s->ops_filters);
 }
 
+/*
+ * damos_commit_dests() - Copy migration destinations from @src to @dst.
+ * @dst:	Destination structure to update.
+ * @src:	Source structure to copy from.
+ *
+ * If the number of destinations has changed, the old arrays in @dst are freed
+ * and new ones are allocated.  On success, @dst contains a full copy of
+ * @src's arrays and count.
+ *
+ * On allocation failure, @dst is left in a partially torn-down state: its
+ * arrays may be NULL and @nr_dests may not reflect the actual allocation
+ * sizes.  The structure remains safe to deallocate via damon_destroy_scheme(),
+ * but callers must not reuse @dst for further commits — it should be
+ * discarded.
+ *
+ * Return: 0 on success, -ENOMEM on allocation failure.
+ */
 static int damos_commit_dests(struct damos_migrate_dests *dst,
 		struct damos_migrate_dests *src)
 {
_

Patches currently in -mm which might be from objecting@objecting.org are

lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch
mm-damon-core-document-damos_commit_dests-failure-semantics.patch
lib-glob-fix-grammar-and-replace-non-inclusive-terminology.patch
lib-glob-add-explicit-include-for-exporth.patch
lib-glob-replace-bitwise-or-with-logical-operation-on-boolean.patch
lib-glob-clean-up-bool-abuse-in-pointer-arithmetic.patch
lib-uuid-fix-typo-reversion-to-revision-in-comment.patch
lib-inflate-fix-memory-leak-in-inflate_fixed-on-inflate_codes-failure.patch
lib-inflate-fix-memory-leak-in-inflate_dynamic-on-inflate_codes-failure.patch
lib-inflate-fix-grammar-in-comment-variable-to-variables.patch
lib-inflate-fix-typo-this-results-to-the-results-in-comment.patch
lib-bug-fix-inconsistent-capitalization-in-bug-message.patch
lib-bug-remove-unnecessary-variable-initializations.patch
lib-idr-fix-ida_find_first_range-missing-ids-across-chunk-boundaries.patch
lib-decompress_bunzip2-fix-32-bit-shift-undefined-behavior.patch
lib-ts_bm-fix-integer-overflow-in-pattern-length-calculation.patch
lib-ts_kmp-fix-integer-overflow-in-pattern-length-calculation.patch
lib-glob-initialize-back_str-to-silence-uninitialized-variable-warning.patch
lib-bch-fix-signed-left-shift-undefined-behavior.patch
lib-bch-fix-signed-shift-overflow-in-build_mod8_tables.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: + mm-damon-core-document-damos_commit_dests-failure-semantics.patch added to mm-new branch
  2026-03-20 17:50 + mm-damon-core-document-damos_commit_dests-failure-semantics.patch added to mm-new branch Andrew Morton
@ 2026-03-20 17:53 ` Josh Law
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Law @ 2026-03-20 17:53 UTC (permalink / raw)
  To: Andrew Morton, mm-commits, sj, akpm



On 20 March 2026 17:50:25 GMT, Andrew Morton <akpm@linux-foundation.org> wrote:
>
>The patch titled
>     Subject: mm/damon/core: document damos_commit_dests() failure semantics
>has been added to the -mm mm-new branch.  Its filename is
>     mm-damon-core-document-damos_commit_dests-failure-semantics.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-document-damos_commit_dests-failure-semantics.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: Josh Law <objecting@objecting.org>
>Subject: mm/damon/core: document damos_commit_dests() failure semantics
>Date: Fri, 20 Mar 2026 07:36:45 -0700
>
>Add a kernel-doc-like comment to damos_commit_dests() documenting its
>allocation failure contract: on -ENOMEM, the destination structure is left
>in a partially torn-down state that is safe to deallocate via
>damon_destroy_scheme(), but must not be reused for further commits.
>
>This was unclear from the code alone and led to a separate patch [1]
>attempting to reset nr_dests on failure.  Make the intended usage explicit
>so future readers do not repeat the confusion.
>
>Link: https://lkml.kernel.org/r/20260320143648.91673-1-sj@kernel.org
>Link: https://lore.kernel.org/20260318214939.36100-1-objecting@objecting.org [1]
>Signed-off-by: Josh Law <objecting@objecting.org>
>Cc: Andrew Morton <akpm@linux-foundation.org>
>Reviewed-by: SeongJae Park <sj@kernel.org>
>Signed-off-by: SeongJae Park <sj@kernel.org>
>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>---
>
> mm/damon/core.c |   17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
>--- a/mm/damon/core.c~mm-damon-core-document-damos_commit_dests-failure-semantics
>+++ a/mm/damon/core.c
>@@ -1060,6 +1060,23 @@ static void damos_set_filters_default_re
> 		damos_filters_default_reject(&s->ops_filters);
> }
> 
>+/*
>+ * damos_commit_dests() - Copy migration destinations from @src to @dst.
>+ * @dst:	Destination structure to update.
>+ * @src:	Source structure to copy from.
>+ *
>+ * If the number of destinations has changed, the old arrays in @dst are freed
>+ * and new ones are allocated.  On success, @dst contains a full copy of
>+ * @src's arrays and count.
>+ *
>+ * On allocation failure, @dst is left in a partially torn-down state: its
>+ * arrays may be NULL and @nr_dests may not reflect the actual allocation
>+ * sizes.  The structure remains safe to deallocate via damon_destroy_scheme(),
>+ * but callers must not reuse @dst for further commits ��� it should be
>+ * discarded.
>+ *
>+ * Return: 0 on success, -ENOMEM on allocation failure.
>+ */
> static int damos_commit_dests(struct damos_migrate_dests *dst,
> 		struct damos_migrate_dests *src)
> {
>_
>
>Patches currently in -mm which might be from objecting@objecting.org are
>
>lib-maple_tree-fix-swapped-arguments-in-mas_safe_pivot-call.patch
>mm-damon-core-document-damos_commit_dests-failure-semantics.patch
>lib-glob-fix-grammar-and-replace-non-inclusive-terminology.patch
>lib-glob-add-explicit-include-for-exporth.patch
>lib-glob-replace-bitwise-or-with-logical-operation-on-boolean.patch
>lib-glob-clean-up-bool-abuse-in-pointer-arithmetic.patch
>lib-uuid-fix-typo-reversion-to-revision-in-comment.patch
>lib-inflate-fix-memory-leak-in-inflate_fixed-on-inflate_codes-failure.patch
>lib-inflate-fix-memory-leak-in-inflate_dynamic-on-inflate_codes-failure.patch
>lib-inflate-fix-grammar-in-comment-variable-to-variables.patch
>lib-inflate-fix-typo-this-results-to-the-results-in-comment.patch
>lib-bug-fix-inconsistent-capitalization-in-bug-message.patch
>lib-bug-remove-unnecessary-variable-initializations.patch
>lib-idr-fix-ida_find_first_range-missing-ids-across-chunk-boundaries.patch
>lib-decompress_bunzip2-fix-32-bit-shift-undefined-behavior.patch
>lib-ts_bm-fix-integer-overflow-in-pattern-length-calculation.patch
>lib-ts_kmp-fix-integer-overflow-in-pattern-length-calculation.patch
>lib-glob-initialize-back_str-to-silence-uninitialized-variable-warning.patch
>lib-bch-fix-signed-left-shift-undefined-behavior.patch
>lib-bch-fix-signed-shift-overflow-in-build_mod8_tables.patch
>



Thanks Andrew for the merge!

V/R


Josh Law

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-20 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 17:50 + mm-damon-core-document-damos_commit_dests-failure-semantics.patch added to mm-new branch Andrew Morton
2026-03-20 17:53 ` Josh Law

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.