Re: [PATCH v2 3/4] mm: introduce bpf_mthp_ops struct ops

From: David Hildenbrand (Arm)

Date: Fri May 08 2026 - 16:55:18 EST


>
> #include <linux/fs.h> /* only for vma_is_dax() */
> #include <linux/kobject.h>
> @@ -296,6 +297,11 @@ unsigned long thp_vma_allowable_orders(struct vm_area_struct *vma,
> enum tva_type type,
> unsigned long orders)
> {
> + /* The eBPF-specified orders overrides which order is selected. */
> + orders &= bpf_mthp_choose(vma->vm_mm, orders);
> + if (!orders)
> + return 0;
> +

There was some discussion around this in the past: where should we hook into
(e.g., deferred shrinker?), which information should we provide to the hook
(e.g., vma properties?).

We concluded mostly to "we don't know". I know that Rik van Riel wanted to look
into doing this properly, but seems like he got distracted :)

I assume there will be a lwn.net article covering the "BPF in MM" session we had
at LSF/MM just this week.

Conclusion: ABI stability is a headake.

The simplistic approach of deciding an order for the whole MM is very likely not
what we want.

--
Cheers,

David