Subject: CVS commit: src/sys/arch/amd64/amd64
To: None <source-changes@NetBSD.org>
From: David Laight <dsl@netbsd.org>
List: source-changes
Date: 10/27/2007 22:56:41
Module Name:	src
Committed By:	dsl
Date:		Sat Oct 27 22:56:41 UTC 2007

Modified Files:
	src/sys/arch/amd64/amd64: syscall.c

Log Message:
Instead of having 2 copies of the sycall entry code, reprocess the file
to generate syscall_plain() with #defines to remove the trace calls.
Join the club of making micro-optimisations to this code to speed up
benchmarks of empty system calls (eg getpid()):
- Use __predict_false() to get fewer branches in the 'normal' path.
- Just copy all the arguments from the stack frame to 'args', since the
  jump indirect for the switch statement is basically unpredicatable.
- Keep the (rather pointless) test for 0 arguments - just for higher
  benchmark scores.
NB system call timing are dominated by other factors! I measured getppid()
  as faster than getpid(), sometimes open("foo", -1) was also faster.
I also suspect that if trace_is_enabled(p) were a simple bit test (that
could be inlined), then the cost of the tests would be unmeasurable and
the syscall_plain/fancy fiasco could be expunged completely.


To generate a diff of this commit:
cvs rdiff -r1.28 -r1.29 src/sys/arch/amd64/amd64/syscall.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.