Question about synchronization in socow_setup()

From: Andrey Simonenko (simon_at_comsys.ntu-kpi.kiev.ua)
Date: 06/23/05

  • Next message: Daniel Eischen: "Re: Nagios and threads"
    Date: Thu, 23 Jun 2005 12:39:40 +0300
    To: freebsd-hackers@freebsd.org
    
    

    Hello,

    Can somebody explain how socow_setup() synchronizes access to the page
    it wants to COW:

        99 s = splvm();
                  
       100 /*
       101 * verify page is mapped & not already wired for i/o
       102 */
       103 socow_stats.attempted++;
       104 pa=pmap_extract(map->pmap, uva);
       105 if(!pa) {
       106 socow_stats.fail_not_mapped++;
       107 splx(s);
       108 return(0);
       109 }
       110 pp = PHYS_TO_VM_PAGE(pa);
                  
       111 /*
       112 * set up COW
       113 */
       114 vm_page_lock_queues();
       115 vm_page_cowsetup(pp);

    How socow_setup() is sure, that pp is valid after pmap_extract()
    (line 104) and before vm_page_lock_queues() (line 114) ?

    Another question, why socow_setup() uses vm_page_wire() instead
    of pmap_extract_and_hold() ? When a page should be held and when
    it should be wired? According the comment for vm_page_hold(), a
    page should be held only for "*very* temporary holding", so when
    one decides what to use (vm_page_hold() or vm_page_wire()), he should
    decide what will be more effective: simply increment m->hold_count or
    increment m->wire_count and remove m from the page queue (so this
    page will be invisible for vm_pageout_scan()). Am I right?
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"


  • Next message: Daniel Eischen: "Re: Nagios and threads"