Re: [PATCH 11/13] mm: cleanup the hmm_vma_handle_pmd stub

From: Christoph Hellwig
Date: Thu Aug 01 2019 - 03:02:06 EST


On Tue, Jul 30, 2019 at 05:53:14PM +0000, Jason Gunthorpe wrote:
> > - /* If THP is not enabled then we should never reach this
>
> This old comment says we should never get here
>
> > +}
> > +#else /* CONFIG_TRANSPARENT_HUGEPAGE */
> > +static int hmm_vma_handle_pmd(struct mm_walk *walk, unsigned long addr,
> > + unsigned long end, uint64_t *pfns, pmd_t pmd)
> > +{
> > return -EINVAL;
>
> So could we just do
> #define hmm_vma_handle_pmd NULL
>
> ?
>
> At the very least this seems like a WARN_ON too?

Despite the name of the function hmm_vma_handle_pmd is not a callback
for the pagewalk, but actually called from hmm_vma_handle_pmd.

What we could try is just and empty non-inline prototype without an
actual implementation, which means if the compiler doesn't optimize
the calls away we'll get a link error.