On Fri, Aug 08, 2025 at 07:55:37PM +0530, Donet Tom wrote: [...]
Thanks for the detailed analysis.
So the key is child has no ksm_rmap_item which will not clear ksm_merging_page on ksm_unmerge().
So, only processes that performed KSM merging will have their counters updated during ksm_unmerge(). The child process, having not initiated any merging, retains the inherited counter value without any update.
So from a testing point of view, I think it is better to reset the counters as part of the cleanup code to ensure that the next tests do not get incorrect values.
Hmm... I agree from the test point of view based on current situation.
While maybe this is also a check point for later version.
Are you okay to proceed with the current patch in this series?
Sure.