On Wed, Jan 05, 2011 at 05:58:34AM +0000, YAMAMOTO Takashi wrote: > hi, > > > I take silence as "no objection". > > the silence in this case means was-busy-for-other-things-and-forgot. > sorry. > > >> I have no real code for this big picture at this moment. Making > >> vm_physseg available as reference is the first step. This only > >> changes uvm_page_physload() to return a pointer: > >> > >> -void uvm_page_physload(); > >> +void *uvm_page_physload(); > >> > >> But this makes XIP pager MUCH cleaner. The reason has been explained > >> many times. > > because the separate uvm_page_physload_device is no longer necessary, > you mean? i have no problem with the step. > > >> Making fault handlers and pagers to use vm_physseg * + off_t is > >> the next step, and I don't intend to work on it now. I just want > >> to explain the big picture. > >> > >> > > >> > >> > >> > >> Keep vm_physseg * + off_t array on stack. If UVM objects uses > >> > >> vm_page (e.g. vnode), its pager looks up vm_page -> vm_physseg * > >> > >> + off_t *once* and cache it on stack. > >> > > >> > do you mean something like this? > >> > struct { > >> > vm_physseg *hoge; > >> > off_t fuga; > >> > } foo [16]; > >> > >> Yes. > >> > >> Or cache vm_page * with it, like: > >> > >> struct vm_id { > >> vm_physseg *seg; > >> off_t off; > >> vm_page *pg; > >> }; > >> > >> uvm_fault() > >> { > >> vm_id pgs[]; > >> : > >> } > >> > >> Vnode pager (genfs_getpages) takes vm_page's by looking up > >> vnode::v_uobj's list, or uvn_findpages(). > >> > >> When it returns back to fault handler, we have to lookup vm_physseg > >> for each page. Then fill the "seg" slot above (assuming we'll > >> remove vm_page::phys_addr soon). > >> > >> Fault handler calls per-vm_page operations iff vm_page slot is filled. > >> XIP pages are not pageq'ed. > > pgo_get returns either seg+off or pg for each vm_id slots?
vm_id[] is passed to pgo_get, each pgo_get (uvn_get, udv_get, ...) will fill seg + off and return the array back to uvm_fault. Pagers that use vm_page (e.g. vnode) will get pg from vnode, then lookup seg+off, fill them into the vm_id slot. Those that don't use vm_page (e.g. cdev) will get seg+off from underlying objects, fill them into the vm_id slot, and return. > > >> XIP pages don't need vm_page, but > >> cached because it's vnode. > > can you explain this sentence? Sorry, it was so unclear. XIP pages don't need vm_page (as a paging state variable), because the pages are read-only and never involve paging. XIP pages have to be mapped as cacheable at MMU level, because it's vnode. I'm allocating the full vm_page for XIP'able pages, only because chs@ wanted to support loaning, which needs vm_page::loan_count. > > >> (Just in case, have you read my paper?) > > which paper? i guess no. http://uebayasi.dyndns.org/~uebayasi/tmp/xip.pdf > > YAMAMOTO Takashi -- Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635