Re: [RFC PATCH 3/4] mm: compaction: don't skip proactive compaction for non-costly mTHP

From: Bo Zhang

Date: Thu Sep 03 2026 - 10:50:24 EST


Thanks for the review.

Sashiko says

"Does this change miss an entry condition check in
should_proactive_compact_node() in the same file? If kswapd is already
active when kcompactd evaluates whether to start,
should_proactive_compact_node() still unconditionally aborts ... Could this
prevent proactive compaction from even starting for non-costly orders,
defeating the updated mid-flight check entirely?"

You're right. I only relaxed the mid-flight check in __compact_finished(),
but should_proactive_compact_node() still bails out unconditionally when
kswapd is running, so for non-costly mTHP orders proactive compaction never
even starts and my change has no effect in the common case (kswapd running
under memory pressure).

In v2 I'll apply the same non-costly condition at the entry check:

if (!sysctl_compaction_proactiveness)
return false;
if (costly && kswapd_is_running(pgdat))
return false;

so the entry and mid-flight checks stay consistent.

Bo