[PATCH v4 1/6] hugepages: Move THP helpers to generic hugepages abstraction

WANG Rui wangrui@loongson.cn
Fri Mar 6 09:19:37 GMT 2026


Hi Wilco,

On Fri, Mar 6, 2026 at 5:27 AM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Rui,
>
> I don't believe we need both malloc-hugepage.c/h as well as hugepage.c/h. That's
> extra complexity and unnecessary abstraction for no gain.
>
> +enum hugepages_thp_mode_t
> +{
> +  hugepages_thp_mode_always,
> +  hugepages_thp_mode_madvise,
> +  hugepages_thp_mode_never,
> +  hugepages_thp_mode_not_supported
> +};
>
> This is getting very hard to read with double use of huge pages. Also it's 2026 and
> we're still having to work around this crazy 80 character limit... So why not just:
>
> enum thp_mode_t
> {
>   thp_mode_always,
>   thp_mode_madvise,
>   thp_mode_never,
>   thp_mode_not_supported
> };
>
> Similarly get_thp_mode () and get_thp_size () would be easier to understand without
> prefixes and redundant "__". We don't need malloc specific veneers for these.
>
> It's best to remove the DEFAULT_THP_PAGESIZE check. MALLOC_DEFAULT_THP_PAGESIZE
> can be defined by the hugepage.h header since it is directly related to huge pages, however
> it doesn't need to be checked in get_thp_size().

I'll make these changes in v5 except for removing the "__" prefixes,
since the symbols would otherwise become visible in the user namespace
and cause conform/linknamespace failures.

Thanks,
Rui



More information about the Libc-alpha mailing list