linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/2] allow to inline generic entry
@ 2023-05-16 13:38 Sven Schnelle
  2023-05-16 13:38 ` [PATCH 1/2] entry: move the exit path to header files Sven Schnelle
  2023-05-16 13:38 ` [PATCH 2/2] entry: move the enter " Sven Schnelle
  0 siblings, 2 replies; 10+ messages in thread
From: Sven Schnelle @ 2023-05-16 13:38 UTC (permalink / raw)
  To: Thomas Gleixner, Peter Zijlstra, Frederic Weisbecker,
	Eric W . Biederman, Mark Rutland, Andy Lutomirski
  Cc: linux-s390, hca, linux-kernel

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(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-17  5:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 13:38 [RFC 0/2] allow to inline generic entry Sven Schnelle
2023-05-16 13:38 ` [PATCH 1/2] entry: move the exit path to header files Sven Schnelle
2023-05-16 16:42   ` Peter Zijlstra
2023-05-16 20:20     ` Eric W. Biederman
2023-05-17  5:45     ` Sven Schnelle
2023-05-16 16:52   ` kernel test robot
2023-05-16 18:33   ` kernel test robot
2023-05-16 19:01   ` kernel test robot
2023-05-16 13:38 ` [PATCH 2/2] entry: move the enter " Sven Schnelle
2023-05-16 19:55   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).