"which CPU"?
There can be multiple CPUs. Even with a single thread:
CPU1 CPU2
mmu1
switch to lazy
mmu1 still active
-- wakeup --
mmu1 wakes up here, lazy process still busy on CPU1
mmu1 still active mmu1 active here too
mmap()
tlb-flush needs to flush both CPU's
mmap()
tlb-flush needs to flush just ONE CPU!!!
Note the important thing: the mmu context is active on both CPU's because
of lazy TLB state, but you definitely do NOT want to keep on making cross-
CPU calls every single time the process is running. Remember: lazy TLB is
supposed to speed things up, not slow them down.
Your patch will either be buggy (I didn't look closely enough), or it will
do the cross-CPU call every single time the process changes its mappings,
simply because somebody has that mapping lazily on another CPU even though
its not actively using the user mode portion of it.
Linus
-
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.tux.org/lkml/