Re: Don't save registers during system calls

Andrej Presern (andrejp@luz.fe.uni-lj.si)
Fri, 17 Apr 1998 01:25:23 +0200


Alexander Kjeldaas wrote:
>
> There is currently an interesting thread on comp.arch discussing
> whether we really need to save registers during system calls. It seems
> that this is not requires and could save a few % on RISCs.
>
> In Linux, it seems like this means moving the register-saving from
> arch/*/kernel/entry.S to include/asm-*/system.h and the switch_to
> macro. In addition, you have to scramble clobber registers on exit
> from the kernel in entry.S, but that's a very fast operation. You only
> save registers when you switch the currently runnig task on a
> processor, not when crossing the kernel<->user-level boundary. This is
> only beneficial if the number of switches inside the kernel is lower
> than the number of system-calls which I assume is true. This isn't
> much point in doing on x86, but for RISCs and merced it could be
> interesting.

It's not really a question whether to save registers during system calls
but rather the amount of TLB flushing and restoring at virtual address
switch. If instead of the whole TLB only a few entries are changed, a
lot of performance could be won since changing an individual entry in
the TLB is a lot cheaper than flushing and reloading the TLB.

This method however requires small objects and Linux doesn't know about
small objects since the objects can assume whole virtual address space.
An alternative operating system model that favours the small address
space is a pure capabilities based one. Note that since faster address
space switching means that the border of authority is becoming cheaper
to cross, it doesn't really matter that much anymore how often we cross
the border. Such a change would result in small system objects that
could provide a virtually arbitrarily fine-grained control while still
gaining us some performance.

Andrej

-- 
Andrej Presern, andrejp@luz.fe.uni-lj.si

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu