Re: [RFC PATCH v3 3/5] mm, thp: add bpf thp hook to determine thp reclaimer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 18, 2025 at 12:06 AM Usama Arif <usamaarif642@xxxxxxxxx> wrote:
>
>
>
> On 08/06/2025 08:35, Yafang Shao wrote:
> > A new hook, bpf_thp_gfp_mask(), is introduced to determine whether memory
> > reclamation is being performed by the current task or by kswapd.
> >
> > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
> > ---
> >  include/linux/huge_mm.h | 5 +++++
> >  mm/huge_memory.c        | 5 +++++
> >  2 files changed, 10 insertions(+)
> >
> > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> > index db2eadd3f65b..6a40ebf25f5c 100644
> > --- a/include/linux/huge_mm.h
> > +++ b/include/linux/huge_mm.h
> > @@ -198,6 +198,11 @@ static inline int bpf_thp_allocator(unsigned long vm_flags,
> >       return THP_ALLOC_KHUGEPAGED | THP_ALLOC_CURRENT;
> >  }
> >
> > +static inline gfp_t bpf_thp_gfp_mask(bool vma_madvised)
> > +{
> > +     return 0;
> > +}
> > +
> >  static inline int highest_order(unsigned long orders)
> >  {
> >       return fls_long(orders) - 1;
> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > index d3e66136e41a..81c1711d13fa 100644
> > --- a/mm/huge_memory.c
> > +++ b/mm/huge_memory.c
> > @@ -1280,6 +1280,11 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf)
> >  gfp_t vma_thp_gfp_mask(struct vm_area_struct *vma)
> >  {
> >       const bool vma_madvised = vma && (vma->vm_flags & VM_HUGEPAGE);
> > +     gfp_t gfp_mask;
> > +
> > +     gfp_mask = bpf_thp_gfp_mask(vma_madvised);
>
>
> I am guessing bpf_thp_gfp_mask returns 0, as its something yet to be implemented,
> but I really dont understand what this patch is supposed to do.

This change only introduces a placeholder for the BPF program. It
might be cleaner to squash it into patch #4.

-- 
Regards
Yafang





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux