Re: [PATCH v5 4/9] mm/collapse: add collapse.h for the collapse interface

From: Lance Yang

Date: Thu Oct 15 2026 - 00:41:18 EST



On Wed, Oct 14, 2026 at 06:11:37PM +0100, Kiryl Shutsemau (Meta) wrote:
>khugepaged.c holds both the users of collapse and the machinery that
>performs it. The daemon's scan loop, the sysfs tunables, MADV_COLLAPSE's
>entry point and the collapse itself all sit in one file and reach into
>each other freely. Nothing marks where a user ends and the engine
>begins.
>
>Start drawing that line.
>
>Add mm/collapse.h for what the two sides have to agree on:
>
> - enum scan_result - what the engine hands back;
> - struct collapse_control - the state a request carries.
>
>And two constants move with them:
>
> - KHUGEPAGED_MAX_PTES_LIMIT -> COLLAPSE_MAX_PTES_LIMIT;
> - KHUGEPAGED_MIN_MTHP_ORDER -> COLLAPSE_MIN_MTHP_ORDER.
>
>Neither is a fact about the daemon, so both lose the KHUGEPAGED_ prefix.
>
>No functional change.
>
>Assisted-by: LLM
>Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
>Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
>Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
>---

Reviewed-by: Lance Yang <lance.yang@xxxxxxxxx>