Re: [PATCH] i386 uaccess to fixmap pages

Jamie Lokier (jamie@shareable.org)
Sat, 10 May 2003 21:52:51 +0100


H. Peter Anvin wrote:
> >It doesn't need a PTE. The vsyscall code could be _copied_ to the end
> >of the page at 0xbffff000, with the stack immediately preceding it.
> >
>
> You don't really want that, though. If you're doing gettimeofday() in
> user space it's critically important that the kernel can modify all
> these pages at once.

I think gettimeofday() is exceptional, and other system call
accelerators actually want per-task data. For example sigprocmask()
can be done in user space, but that needs a per-task mask

For gettimeofday(), the kernel can (a) update the word in the mm of
currently running tasks on timer interrupts, (b) update the word at
context switch time, and then only when switching mm. Ok, I'll admit
that is looking a bit messed up, and possible SMP synchronisation
problems too.

How about this: gettimeofday() in user space simply does rdtsc, and if
the number of clocks since the last jiffy update is above a threshold,
it does a syscall. If rdtsc is not available, it always does the
syscall.

Per-mm vsyscall data is appropriate for that, and no globally shared
page is required. (Think of the NUMA! :)

Granted, sharing the vsyscall and stack ptes is not great if the
vsyscall code expands considerably. As it is now, it's a very small
bit of code which costs nothing to copy.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/