>On Tue, 9 Apr 1996, David S. Miller wrote:
>> On the I386 a kernel thread switch does indeed flush the TLB (but tlb
>> flushes on the intel are cheap and Linus could optimize this away if
>isn't it so, that the TLB has to be flushed only if the root page table
>directory changes (the value of CR3 put into the TSS)? Dont know if
>CR3 changes for a i386 Linux clone()-ed VM_SHARE process though :(
Every task, even when cloned, currently gets its own TSS, and switches
between tasks are done with a 'jmp TSS' instruction (see switch_to);
this includes reloading CR3 from the new TSS, which initiates a TLB flush.
Optimizing it away, as David suggests, would mean to replace the
'jmp TSS' instruction with code that explicitly saves/restores state
without modifying CR3; it might even save some other restoration work.
I think this change would have minimal impact on other parts of
the kernel; the switch_to is in exactly one place (schedule), setting
up a new task might have to change, but nothing else.
(is this correct? Linus?)
bye
Patrick