i386 pmap_zero_page() late sched_pin()?

Venkatesh Srinivas vsrinivas at dragonflybsd.org
Sun Dec 12 17:08:43 UTC 2010


Hi,

In the i386 pmap's pmap_zero_page(), there is a fragment...

 	sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)];
 	mtx_lock(&sysmaps->lock);
*	sched_pin();
 	/*map the page we mean to zero at sysmaps->CADDR2*/
 	pagezero(sysmaps->CADDR2);
 	sched_unpin();

I don't know this bit of code too well, so I don't know if the sched_pin() 
being where it is is okay or not. My first reading says its not okay; if a 
thread is moved to another CPU before it is able to pin, it will use the 
wrong sysmaps structure. Is this the case? Is it alright that the wrong 
sysmap structure is used?

Oh, Nathaniel Filardo (nwf at cs.jhu.edu) first spotted this, not I.

Thanks,
-- vs


More information about the freebsd-hackers mailing list