On Wed, Nov 11, 2020 at 04:57:24PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 11, 2020 at 03:30:22PM +0000, Matthew Wilcox wrote:
> > This confuses me.  Why only special-case hugetlbfs pages here?  Should
> > they really be treated differently from THP?  If you want to consider
> > that we might be mapping a page that's twice as big as a PUD entry and
> > this is only half of it, then the simple way is:
> > 
> >     if (pud_leaf(pud)) {
> > #ifdef pud_page
> >             page = compound_head(pud_page(*pud));
> >             return page_size(page);
> 
> Also; this is 'wrong'. The purpose of this function is to return the
> hardware TLB size of a given address. The above will return the compound
> size, for any random compound page, which would be myrads of reasons.

Oh, then the whole thing is overly-complicated.  This should just be

        if (pud_leaf(pud))
                return PUD_SIZE;

Reply via email to