Skip to content

RFC allow to inline generic entry

Sven Schnelle linux-s390 lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2entry: move the exit path to header filesinclude/linux/entry-common.h kernel/entry/common.c+179 -1713 replies
2/2entry: move the enter path to header filesinclude/linux/entry-common.h kernel/entry/common.c+118 -1180 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/2] allow to inline generic entry

Hi,

i looked into the syscall performance on s390 with the latest kernel. For that reason i wrote a small syscall test program, which just calls getpid() in a loop:

#include <stdio.h>
#include <time.h>
#include <bsd/sys/time.h>
#include <unistd.h>
static const double nsec_per_sec = 1000000000;

int main(int argc, char **argv)

{
	struct timespec start, end, res;
	double diff;
	int i;
	(void)argc;
	(void)argv;

	clock_gettime(CLOCK_REALTIME, &start);
	for (i = 0; i < 150000000; i++) {
		volatile int a = getpid();
		(void)a;
	}

	clock_gettime(CLOCK_REALTIME, &end);
	timespecsub(&end, &start, &res);
	diff = ((double)res.tv_sec * nsec_per_sec + (double)res.tv_nsec) / nsec_per_sec;
	printf("%f\n", diff);
	return 0;
}

Analyzing performance data i see some overhead in the generic entry C functions, which are not inlined because they are defined in kernel/entry/common.c. Moving them to include/linux/entry-common.h gives me the following runtime for the loop above:

with entry common code inlined: 12.8s
not inlined: 13.8s

While i prefer to have C functions in C files instead of header files, 7% performance gain is quite a lot, so i wonder what people think about moving them to header files. I made this a small patchset for reference, if there is interest in merging that i'll clean it up and submit it.

Any thoughts?

Sven Schnelle (2):
entry: move the exit path to header files
entry: move the enter path to header files

 include/linux/entry-common.h | 305 ++++++++++++++++++++++++++++++++++-
 kernel/entry/common.c        | 281 --------------------------------
 2 files changed, 297 insertions(+), 289 deletions(-)
Signature · 1 line
2.39.2