On Mon, May 07, 2018 at 12:23:46PM +0000, Matthew Wilcox wrote: > On Mon, May 07, 2018 at 02:31:25PM +0300, Kirill A. Shutemov wrote: > > > Also, what does lvl == 0 mean? Is it the top or the bottom? I think a > > > comment would be helpful. > > > > It is bottom. But it should be up to architecture to decide. > > That's not true because ... > > > > > +static inline void ptp_walk(ptp_t *ptp, unsigned long addr) > > > > +{ > > > > + ptp->ptr = (unsigned long *)ptp_page_vaddr(ptp); > > > > + ptp->ptr += __pt_index(addr, --ptp->lvl); > > > > +} > > > > > > Can you add a comment that says what this function does? > > > > Okay, I will. > > > > > Why does it not change the level? > > > > It does. --ptp->lvl. > > ... you've hardcoded that walking down decrements the level by 1. > > I don't see that as a defect; it's just part of the API that needs > documenting. You assume that the function is a generic one. This may or may not be true. This is subject for refinement anyway. -- Kirill A. Shutemov