Date: Thu, 23 Jun 2005 12:39:40 +0300 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: freebsd-hackers@freebsd.org Subject: Question about synchronization in socow_setup() Message-ID: <20050623093940.GA338@pm514-9.comsys.ntu-kpi.kiev.ua>
next in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050623093940.GA338>
