From: Emanuele Rocca <ema@debian.org>
To: linux-kernel@vger.kernel.org
Cc: Michal Hocko <mhocko@suse.com>
Subject: Runtime overhead of PREEMPT_DYNAMIC
Date: Fri, 20 Oct 2023 11:14:43 +0200 [thread overview]
Message-ID: <ZTJFA_Ac6nWawIHb@ariel> (raw)
Hi,
the Kconfig help for PREEMPT_DYNAMIC states the following:
The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled
but if runtime patching is not available for the specific architecture
then the potential overhead should be considered.
I've tried evaluating the practical runtime overhead of PREEMPT_DYNAMIC
on my Ryzen 7 x86 workstation and it does actually seem quite
significant, for certain workloads.
I tried four different workloads: the first two are userspace-heavy (ie: the
CPU spends most of its time executing at the user level, as reported by sar
%user). There is *no* significant performance difference between a kernel with
PREEMPT_DYNAMIC=y and a kernel with PREEMPT_DYNAMIC=n for those:
1) compressing data with `xz -T 0` (less than 1% system)
dd if=/dev/urandom of=/dev/stdout bs=1M count=1024 | xz --stdout -T 0 > /dev/null
2) building a kernel (10% system)
The third and fourth benchmarks are kernel-heavy (ie: most of the CPU time is
at the system level, as reported by sar %system). The performance difference
between PREEMPT_DYNAMIC=y and PREEMPT_DYNAMIC=n is quite visible for those:
3) load testing nginx (35% system)
4) tbench (90% system)
see https://www.samba.org/ftp/tridge/dbench/README
Details of the nginx benchmark:
- 'hey' (https://github.com/rakyll/hey) HTTP load generator version 0.1.4-2
- nginx 1.24.0 serving the default 'Welcome to nginx!' page
- logging to disk disabled with `access_log off` in nginx.conf
- hey -n 2000000 http://localhost/ | grep Requests
Results of the nginx benchmark:
- PREEMPT_DYNAMIC=n 102K rps
- PREEMPT_DYNAMIC=y 96K rps
- 5% performance degradation with PREEMPT_DYNAMIC
Details of the tbench benchmark:
- tbench version 4.0 https://www.samba.org/ftp/tridge/dbench/
- Run /usr/bin/tbench_srv in a window
- Run /usr/bin/tbench `nproc` in another window
Results of the tbench benchmark:
- PREEMPT_DYNAMIC=n Throughput 3831.82 MB/sec
- PREEMPT_DYNAMIC=y Throughput 3006.54 MB/sec
- 20% performance degradation with PREEMPT_DYNAMIC
All the tests above were performed using Linux 6.5.6 on a AMD Ryzen 7 3700X
8-Core CPU.
Could someone please confirm whether the approach above seems sane and perhaps
try and reproduce the results?
Thanks,
Emanuele
next reply other threads:[~2023-10-20 9:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 9:14 Emanuele Rocca [this message]
2023-10-20 12:42 ` Runtime overhead of PREEMPT_DYNAMIC Mike Galbraith
2023-10-20 13:40 ` Emanuele Rocca
2023-10-20 14:11 ` Mike Galbraith
2023-10-20 14:34 ` Mike Galbraith
2023-10-20 14:45 ` Emanuele Rocca
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=ZTJFA_Ac6nWawIHb@ariel \
--to=ema@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.