public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@linux.ibm.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Andy Lutomirski <luto@kernel.org>
Cc: linux-s390@vger.kernel.org, hca@linux.ibm.com,
	linux-kernel@vger.kernel.org
Subject: [RFC 0/2] allow to inline generic entry
Date: Tue, 16 May 2023 15:38:08 +0200	[thread overview]
Message-ID: <20230516133810.171487-1-svens@linux.ibm.com> (raw)

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


             reply	other threads:[~2023-05-16 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16 13:38 Sven Schnelle [this message]
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 13:38 ` [PATCH 2/2] entry: move the enter " Sven Schnelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230516133810.171487-1-svens@linux.ibm.com \
    --to=svens@linux.ibm.com \
    --cc=ebiederm@xmission.com \
    --cc=frederic@kernel.org \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox