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

From: David Hildenbrand (Arm)

Date: Thu Mar 05 2026 - 07:42:40 EST



>> +
>> + /* Check if anything has to be done */
>> + if (hugepage_pmd_enabled() == !!khugepaged_thread)
>
> This is horrible, better to break out the latter expression as a small static
> function like:
>
> static bool is_khugepaged_thread_running(void)
> {
> if (khugepaged_thread)
> return true;
> return false;

return khugepaged_thread;

should do the trick, given taht the return type of the function is a bool :)

> }

--
Cheers,

David