Re: [patch] smp tlb flushing

Linus Torvalds (torvalds@transmeta.com)
Sat, 11 Sep 1999 09:22:39 -0700 (PDT)


On Sat, 11 Sep 1999, Andrea Arcangeli wrote:
>
> IMHO cpu_vm_mask should simply and only tell on which CPU a certain
> mm_struct is running on. It should tell on which CPUs current->active_mm
> is equal to the mm where we reading mm->cpu_vm_mask.

"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/