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

From: Lorenzo Stoakes

Date: Mon May 11 2026 - 07:25:36 EST


On Fri, May 08, 2026 at 10:54:58PM +0200, David Hildenbrand (Arm) wrote:
> >
> > #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.

Agreed with all points!

>
> --
> Cheers,
>
> David

Cheers, Lorenzo