Ok. It gets hairy, but probably not impossible. You have to use the
global bit in the page table as Colin Plumb mentioned. You have one
page-table entry in the mm-struct that is reserved for "bogus"
use. Using the global bit, the actual contents of this entry doesn't
have to match the contents of the TLB entry of the CPU. You only use
this entry to _load_ this TLB entry on entry to the kernel.
Here's an outline of what you could do on a system call entry (SMP):
if current is a system-timeaholic, or
current->mm is not shared; then
# 1) this process uses a _lot_ of system calls, we find it best
# to allocate a static TLB entry pointing to current for this
# process, even when executing in user mode.
# _or_,
# 2) this process' mm isn't shared, so current->mm->special-entry is
# pointing to the correct current anyways
# ergo, do nothing
else
# thread
grab current->mm->special-entry-lock
current->mm->special-entry = %esp & ~8191
set global-flag on current->mm->special-entry
access __current
release current->mm->special-entry-lock
end
..and then on exit:
if current is a system-timeaholic, or
current->mm is not shared; then
# nothing
else
# thread
grab current->mm->special-entry-lock
remove global flag from current->mm->special-entry
invalidate __current TLB entry
release current->mm->special-entry-lock
end
The "system-timeaholic" flag is just something that could be used if
we have a thread that is using most of its time in the kernel.
astor
-- Alexander Kjeldaas, Guardian Networks AS, Trondheim, Norway http://www.guardian.no/- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html