Re: (sashiko review) [RFC PATCH 2/2] Docs/admin-guide/mm/damon/lru_sort: warn commit_inputs vs param updates race
From: SeongJae Park <sj@kernel.org>
Date: 2026-03-28 17:35:06
Also in:
damon, linux-mm, lkml, stable
Forwarding Sashiko review for doing discussions via mails. # review url: https://sashiko.dev/#/patchset/20260328172415.49940-3-sj@kernel.org # start of sashiko.dev inline review commit 0a9a055d4225a92c337c76fef97bfcdca5d9508f Author: SeongJae Park [off-list ref] 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@objecting.org (local)
quoted hunk ↗ jump to hunk
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@kernel.org # # 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@kernel.org # # [1] https://github.com/sjp38/hackermail Sent using hkml (https://github.com/sjp38/hackermail)