Re: [PATCH 0/2] mm: thp: reduce unnecessary start_stop_khugepaged() calls

From: Breno Leitao

Date: Wed Mar 04 2026 - 06:57:04 EST


Hello Kiryl,

On Wed, Mar 04, 2026 at 11:18:37AM +0000, Kiryl Shutsemau wrote:
> On Wed, Mar 04, 2026 at 02:22:32AM -0800, Breno Leitao wrote:
> > Breno Leitao (2):
> > mm: thp: avoid calling start_stop_khugepaged() in anon_enabled_store()
> > mm: thp: avoid calling start_stop_khugepaged() in enabled_store()
>
> I think the same can be achieved cleaner from within start_stop_khugepaged().

Thanks for the review.

I considered this approach as well. From my limited experience, the preference
is to return early in the _store() callbacks when the operation is a no-op,
rather than pushing that logic deeper into nested code.

Handling it at the _store() level results in more changes overall, but it is
arguably more straightforward to reason about (!?).

That said, I am no MM subsystem expert, and I am happy to go either way.

--breno