The traces related to potential memory pressure are affecting kswapd. That does seem to implicate the ksmtuned settings. Is KSM_MAX_KERNEL_PAGES set manually in ksmtuned.conf ? I'd recommend setting DEBUG=1 there too so its actions and values are logged and could be correlated with future hangs.
My feeling right now - with not much to go on - is ksm is trying too hard during memory pressure and there's a vicious cycle between it and kswapd. There are 3 commits related to ksm for the v6.12 stable series. The most pertinent in terms of the explanation in its commit message seems to be commit 6673d1d818f04ff2f "mm/ksm: fix exec/fork inheritance support for prctl" (introduced in v6.12.64) https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.12.y&id=6673d1d818f04ff2f397590e5229a7449b0edf77 However, comparing mainline to the stable series there is a series of commits in mainline that revert and replace the stable commit 74f78421c925b6d176955 "ksm: use range-walk function to jump over holes in scan_get_next_rmap_item" (introduced in v6.12.59) https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.12.y&id=74f78421c925b6d17695566f0c5941de57fd44b3 Mainline since v6.19 has added revert and rework of that commit due to causing CPU hangs 05c3fa9c9fa63 2025-11-16 17:28:28 -0800 N Pedro Demarchi Gomes ksm: replace function unmerge_ksm_pages with break_ksm 5d4939fc2258e 2025-11-16 17:28:28 -0800 N Pedro Demarchi Gomes ksm: perform a range-walk in break_ksm 912aa825957f5 2025-11-16 17:28:28 -0800 N Pedro Demarchi Gomes Revert "mm/ksm: convert break_ksm() from walk_page_range_vma() to folio_walk" Of those the last has an explanation that could match what you're seeing here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/mm/ksm.c?id=912aa825957f556a29d781c8f4cb4f4dfd938a9d It would help to know the earliest kernel version where the hangs do not occur. If the hardware has always suffered this behaviour since first commissioning then the first kernel version used. I've done an initial general sweep of commits in the mm/ sub-system for the v6.12 cycle. There are quite a few so having a version range to focus on may well help. v6.12.3..v6.12.4 has 4 ./mm/ commits v6.12.4..v6.12.5 has 8 ./mm/ commits v6.12.6..v6.12.7 has 5 ./mm/ commits v6.12.8..v6.12.9 has 8 ./mm/ commits v6.12.10..v6.12.11 has 3 ./mm/ commits v6.12.11..v6.12.12 has 3 ./mm/ commits v6.12.13..v6.12.14 has 6 ./mm/ commits v6.12.16..v6.12.17 has 1 ./mm/ commits v6.12.18..v6.12.19 has 13 ./mm/ commits v6.12.19..v6.12.20 has 2 ./mm/ commits v6.12.20..v6.12.21 has 4 ./mm/ commits v6.12.22..v6.12.23 has 3 ./mm/ commits v6.12.23..v6.12.24 has 7 ./mm/ commits v6.12.24..v6.12.25 has 5 ./mm/ commits v6.12.27..v6.12.28 has 2 ./mm/ commits v6.12.28..v6.12.29 has 5 ./mm/ commits v6.12.29..v6.12.30 has 1 ./mm/ commits v6.12.30..v6.12.31 has 3 ./mm/ commits v6.12.34..v6.12.35 has 3 ./mm/ commits v6.12.35..v6.12.36 has 2 ./mm/ commits v6.12.36..v6.12.37 has 3 ./mm/ commits v6.12.38..v6.12.39 has 1 ./mm/ commits v6.12.40..v6.12.41 has 4 ./mm/ commits v6.12.41..v6.12.42 has 2 ./mm/ commits v6.12.42..v6.12.43 has 5 ./mm/ commits v6.12.43..v6.12.44 has 3 ./mm/ commits v6.12.45..v6.12.46 has 8 ./mm/ commits v6.12.47..v6.12.48 has 10 ./mm/ commits v6.12.48..v6.12.49 has 3 ./mm/ commits v6.12.49..v6.12.50 has 3 ./mm/ commits v6.12.53..v6.12.54 has 7 ./mm/ commits v6.12.55..v6.12.56 has 2 ./mm/ commits v6.12.58..v6.12.59 has 9 ./mm/ commits v6.12.59..v6.12.60 has 1 ./mm/ commits v6.12.60..v6.12.61 has 1 ./mm/ commits v6.12.63..v6.12.64 has 23 ./mm/ commits v6.12.66..v6.12.67 has 11 ./mm/ commits v6.12.67..v6.12.68 has 1 ./mm/ commits v6.12.68..v6.12.69 has 4 ./mm/ commits v6.12.69..v6.12.70 has 1 ./mm/ commits v6.12.73..v6.12.74 has 2 ./mm/ commits v6.12.74..v6.12.75 has 4 ./mm/ commits v6.12.77..v6.12.78 has 8 ./mm/ commits v6.12.80..v6.12.81 has 1 ./mm/ commits v6.12.82..v6.12.83 has 1 ./mm/ commits v6.12.83..v6.12.84 has 1 ./mm/ commits v6.12.85..v6.12.86 has 6 ./mm/ commits v6.12.87..v6.12.88 has 1 ./mm/ commits v6.12.89..v6.12.90 has 4 ./mm/ commits v6.12.91..v6.12.92 has 1 ./mm/ commits v6.12.92..v6.12.93 has 5 ./mm/ commits v6.12.93..v6.12.94 has 5 ./mm/ commits v6.12.95..v6.12.96 has 9 ./mm/ commits v6.12.96..v6.12.97 has 8 ./mm/ commits v6.12.100..v6.12.101 has 6 ./mm/ commits v6.12.102..v6.12.103 has 10 ./mm/ commits

