How much does OS operation impact your code`s performance?

Download Report

Transcript How much does OS operation impact your code`s performance?

Characterizing the Microarchitectural
Side Effects of Operating System Calls
Addison Mayberry, Matt Laquidara, Charles Weems
Architecture and Language Implementation Lab
University of Massachusetts Amherst
How much does OS operation impact your code’s performance?
As your program executes, data is stored within the CPU to improve instruction execution time
Branch Predictor
Cache
TLB
When user code makes call to the operating system, these structures are altered
When your code resumes, it will be slowed until this data is replaced
Features
How do we measure this impact?
Challenges
We make use of the MARSSx86
simulator, which is cycle-accurate and
validated against actual hardware
We are able to describe in detail the
low-level effects of OS interference on
microarchitectural state
Our system can clearly demonstrate
the performance decrease that is
caused by OS calls
The results we generate could be used
to improve the accuracy of user-mode
simulators that currently ignore these
effects on performance
We are able to perfectly save system
state for easily repeatable trials
Within a simulator, we back up all of the data in these structures before a system call
The performance of MARSSx86 varies
based on external factors such as
clock events and I/O, multiple trials
must be run for accuracy
We then reset the structures, clearing the original data
This profiling must be done for each
OS version, the results vary between
operating systems
The results are sensitive to perturbing
factors such as the link order of the
compiled kernel
The system call is then allowed to run and put data into the structures
When the call concludes, we record the amount of data that has been stored – this is the call’s impact
Before resuming user code, the original data is placed back into the structure, allowing user code to proceed
at its optimal speed with little or no performance impact
There may be constructive
interference from the OS, such as data
being loaded into cache for user code,
which our system removes
Performing this backup / restore procedure increases the hit rate in each structure, indicating that most of
the impact is destructive
L1D Cache Entries Evicted
Hit Rate Improvement in
apachebench
Meta-Branch-Predictor Entries
180
140
160
1.60%
120
140
120
100
v9.10
v9.10_LR
v12.04
80
60
1.40%
100
1.20%
80
1.00%
v9.10
v9.10_LR
v12.04
60
40
40
0.80%
0.60%
0.40%
20
20
0
0
getpid
mmap
open
stat
times
write
0.20%
0.00%
getpid
mmap
open
stat
times
write
DTLB
BRPRED
L1D_READ L1D_WRITE