On 04/16/08 11:37, Zeljko Vrba wrote:
Prompted by my experiments with extreme number of threads, which show that the number of ITLB misses increases proportionally with the number of threads (even though all threads execute the same code), I dug into the kernel code.Full-text search for CR3 loads reveals hat_switch() in onnv-gate/usr/src/uts/i86pc/vm/hat_i86.c which is used by resume() in onnv-gate/usr/src/uts/intel/ia32/ml/swtch.s The comment at the top of swtch.s states "The MMU context changes when the resuming thread resides in a different process. Kernel threads are known by resume to reside in process 0. The MMU context, therefore, only changes when resuming a thread in a process different from curproc." However, the present code does not seem to check whether the switched-in thread belongs to a different process; instead CR3 is loaded unconditionally. This is consistent with # of ITLB misses being proportional to # of threads. Did I overlook some other place where this check could potentially be performed?
hat_switch short-circuits if the "new" hat is already the current one:
void
hat_switch(hat_t *hat)
{
uint64_t newcr3;
cpu_t *cpu = CPU;
hat_t *old = cpu->cpu_current_hat;
/*
* set up this information first, so we don't miss any cross calls
*/
if (old != NULL) {
if (old == hat)
return; <<<<
Gavin
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
