tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Device page



> Well, i need phys_addr for VM_MDPAGE_INIT to set the initial color of a page 
> but
> that could be a second parameter to it.
> 
> My concern is that if you have several vm_physseg then finding the right could
> be expensive.  Or are we going to sort vm_physmem by increasing pa (and then 
> we
> could use a binary sort)?

There are already sorter & bsearch find code.

    735 void
    736 uvm_page_physload(paddr_t start, paddr_t end, paddr_t avail_start,
    737     paddr_t avail_end, int free_list)
    738 {
        :
    819 #elif (VM_PHYSSEG_STRAT == VM_PSTRAT_BSEARCH)
    820         {
    821                 int x;
    822                 /* sort by address for binary search */
    823                 for (lcv = 0 ; lcv < vm_nphysseg ; lcv++)
    824                         if (start < vm_physmem[lcv].start)
    825                                 break;
    826                 ps = &vm_physmem[lcv];
    827                 /* move back other entries, if necessary ... */
    828                 for (x = vm_nphysseg ; x > lcv ; x--)
    829                         /* structure copy */
    830                         vm_physmem[x] = vm_physmem[x - 1];
    831         }

Masao

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Home | Main Index | Thread Index | Old Index