lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 16 May 2023 15:38:08 +0200
From:   Sven Schnelle <svens@...ux.ibm.com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Frederic Weisbecker <frederic@...nel.org>,
        "Eric W . Biederman" <ebiederm@...ssion.com>,
        Mark Rutland <mark.rutland@....com>,
        Andy Lutomirski <luto@...nel.org>
Cc:     linux-s390@...r.kernel.org, hca@...ux.ibm.com,
        linux-kernel@...r.kernel.org
Subject: [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(-)

-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ