Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2018 04:05:07 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333241 - head/sys/amd64/amd64
Message-ID:  <201805040405.w44457Od029612@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Fri May  4 04:05:07 2018
New Revision: 333241
URL: https://svnweb.freebsd.org/changeset/base/333241

Log:
  amd64: get rid of the pessimized bcopy in syscall arg copy
  
  The code was unnecessarily conditionally copying either 5 or 6 args.
  It can blindly copy 6, which also means the size is known at compilation
  time and the operation can be depessimized.
  
  Note the entire syscall handling code is rather slow.
  
  Tested on Skylake, sample result for getppid (calls/s):
  without pti: 7310106 -> 10653569
  with pti: 3304843 -> 4148306
  
  Some syscalls (like read) did not note any difference, other have typically
  very modest wins.

Modified:
  head/sys/amd64/amd64/trap.c

Modified: head/sys/amd64/amd64/trap.c
==============================================================================
--- head/sys/amd64/amd64/trap.c	Fri May  4 04:00:48 2018	(r333240)
+++ head/sys/amd64/amd64/trap.c	Fri May  4 04:05:07 2018	(r333241)
@@ -908,7 +908,7 @@ cpu_fetch_syscall_args(struct thread *td)
 	error = 0;
 	argp = &frame->tf_rdi;
 	argp += reg;
-	bcopy(argp, sa->args, sizeof(sa->args[0]) * regcnt);
+	bcopy(argp, sa->args, sizeof(sa->args[0]) * 6);
 	if (sa->narg > regcnt) {
 		KASSERT(params != NULL, ("copyin args with no params!"));
 		error = copyin(params, &sa->args[regcnt],



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805040405.w44457Od029612>