Re: Kernel virtual memory?

Benjamin C R LaHaise (blah@dot.superaje.com)
Thu, 7 Aug 1997 23:29:53 +0000 ( )


On Thu, 7 Aug 1997, Victor Yodaiken wrote:

> Shuffling buffers has bad implications for SMP since it will require
> synchronizing tlb flushes on all cpus!

Of course! But the current SMP tlb synchronization can be quite
improved. Take the following quick 'off the top of my head' idea: have
something like:

struct task_struct *cpu_task[NR_CPUS];

void tlb_flush_mm(struct mm_struct *mm)
{
int i;
if (current->mm == mm && mm->count == 1)
tlb_flush_local()
else
for (i=0; i<NR_CPUS; i++) {
struct task_struct *t = cpu_task[i];
if (t->mm == mm)
tlb_flush_cpu(i);
}
}

Remember the only sensible way of shuffling user pages around is to
treat it like swapping. In the code I'm toying with, the page will first
be locked, then all ptes are set to a special 'transient' value. But
this is all just for extreme, hope we never normally do this, type
cases. E.g. a user opens up /dev/videodigitizer which needs a 4 meg
buffer aligned et al.

Hey, the above pseudo (there's no tlb_flush_cpu(x), yet!) code would be a
big win on SMP right now for those people running anything with threads.

-ben