Re: [PATCH v9 mm-new 03/11] mm: thp: add support for BPF based THP order selection
From: David Hildenbrand
Date: Mon Oct 13 2025 - 08:42:06 EST
I came to the same conclusion. At least it's a valid start.
Maybe we would later want a global fallback BPF-THP prog if none was
enabled for a specific MM.
good idea. We can fallback to the global model when attaching pid 1.
But I would expect to start with a per MM way of doing it, it gives you
way more flexibility in the long run.
THP, such as shmem and file-backed THP, are shareable across multiple
processes and cgroups. If we allow different BPF-THP policies to be
applied to these shared resources, it could lead to policy
inconsistencies.
Sure, but nothing new about that (e.g., VM_HUGEPAGE, VM_NOHUGEPAGE, PR_GET_THP_DISABLE).
I'd expect that we focus on anon THP as the first step either way.
Skimming over this series, anon memory seems to be the main focus.
This would ultimately recreate a long-standing issue
in memcg, which still lacks a robust solution for this problem [0].
This suggests that applying SCOPED policies to SHAREABLE memory may be
fundamentally flawed ;-)
Yeah, shared memory is usually more tricky: see mempolicy handling for shmem. There, the policy is much rather glued to a file than to a process.
--
Cheers
David / dhildenb