Re: (sashiko review) [RFC PATCH 2/2] Docs/admin-guide/mm/damon/lru_sort: warn commit_inputs vs param updates race
From: SeongJae Park
Date: Sat Mar 28 2026 - 13:35:17 EST
Forwarding Sashiko review for doing discussions via mails.
# review url: https://sashiko.dev/#/patchset/20260328172415.49940-3-sj@xxxxxxxxxx
# start of sashiko.dev inline review
commit 0a9a055d4225a92c337c76fef97bfcdca5d9508f
Author: SeongJae Park <sj@xxxxxxxxxx>
Docs/admin-guide/mm/damon/lru_sort: warn commit_inputs vs param updates race
This patch adds documentation warning users about a data race in DAMON_LRU_SORT
when modifying module parameters while the kdamond thread is reading them. It
states that violating this rule can cause undefined behavior in the kernel.
Link: https://lore.kernel.org/20260319161620.189392-2-objecting@xxxxxxxxxxxxx
> diff --git a/Documentation/admin-guide/mm/damon/lru_sort.rst b/Documentation/admin-guide/mm/damon/lru_sort.rst
> index a7dea7c75a9b..3eaa3786c8ab 100644
> --- a/Documentation/admin-guide/mm/damon/lru_sort.rst
> +++ b/Documentation/admin-guide/mm/damon/lru_sort.rst
> @@ -79,6 +79,10 @@ of parametrs except ``enabled`` again. Once the re-reading is done, this
> parameter is set as ``N``. If invalid parameters are found while the
> re-reading, DAMON_LRU_SORT will be disabled.
>
> +Once ``Y`` is written to this parametr, the user must not write to any
^^^^^^^^
This isn't a bug, but there is a typo here (parametr).
> +parameters until reading ``commit_inputs`` again returns ``N``. If users
> +violate this rule, the kernel can do undefined behaviors.
^^^^^^^^^^^^^^^^^^^
Should this data race be fixed in the kernel code itself rather than just
documented?
The kernel generally should not exhibit undefined behavior, memory corruption,
or crashes due to concurrent sysfs or module parameter writes, even if those
writes are restricted to root users. Could the underlying code be updated
with proper synchronization to safely handle concurrent updates instead?
> +
> active_mem_bp
> -------------
>
# end of sashiko.dev inline review
# review url: https://sashiko.dev/#/patchset/20260328172415.49940-3-sj@xxxxxxxxxx
#
# hkml [1] generated a draft of this mail. It can be regenerated
# using below command:
#
# hkml patch sashiko_dev --for_forwarding \
# 20260328172415.49940-3-sj@xxxxxxxxxx
#
# [1] https://github.com/sjp38/hackermail
Sent using hkml (https://github.com/sjp38/hackermail)