> Module Name: src > Committed By: ad > Date: Sat Dec 21 14:41:44 UTC 2019 > > - Add inlines to set/get locator values in the unused lower bits of > pg->phys_addr. Begin by using it to cache the freelist index, because > computing it is expensive and that shows up during profiling. Discussed > on tech-kern.
So I guess we won't be switching pg->phys_addr from paddr to pfn? Speaking of which, any plans for expanding to >32-bit (or >31-bit, if signed) pfns in the rest of uvm? > +static inline unsigned > +uvm_page_get_bucket(struct vm_page *pg) > +{ > + return (pg->phys_addr & 0x3e0) >> 5; > +} Can you use __BITS/__SHIFTIN/__SHIFTOUT for this instead of magic hex masks? #define PHYSADDR_FREELIST __BITS(0,4) #define PHYSADDR_BUCKET __BITS(5,9) static inline unsigned uvm_page_get_bucket(struct vm_page *pg) { return __SHIFTOUT(pg->phys_addr, PHYSADDR_BUCKET); } static inline unsigned uvm_page_set_bucket(struct vm_page *pg, unsigned b) { pg->phys_addr &= ~PHYSADDR_BUCKET; pg->phys_addr |= __SHIFTIN(b, PHYSADDR_BUCKET); }