正在试着评估RPi中如果用mlockall把memory锁住会不会改善latency
用著名的cyclictest (v0.92)+perf得到以下结果:
sudo perf stat ./cyclictest -p 90 - m -c 0 -i 3000 -n -h 250 -q -l 10000
# Total: 000009985
# Min Latencies: 00038
# Avg Latencies: 00082
# Max Latencies: 00386
# Histogram Overflows: 00015
Performance counter stats for
'./cyclictest -p 90 -m -c 0 -i 3000 -n -h 250 -q -l 10000':
818.925000 task-clock (msec) # 0.027 CPUs utilized
13,362 context-switches # 0.016 M/sec
0 cpu-migrations # 0.000 K/sec
56 page-faults # 0.068 K/sec
471,078,551 cycles # 0.575 GHz (50.34%)
282,495,112 stalled-cycles-frontend # 59.97% frontend cycles idle (51.67%)
13,419,172 stalled-cycles-backend # 2.85% backend cycles idle (52.93%)
68,489,877 instructions # 0.15 insns per cycle
# 4.12 stalled cycles per insn (38.41%)
7,553,254 branches # 9.223 M/sec (30.02%)
1,627,813 branch-misses # 21.55% of all branches (34.01%)
30.232651000 seconds time elapsed
如果不加-m参数(不用mlockall):
sudo perf stat ./cyclictest -p 90 -c 0 -i 3000 -n -h 250 -q -l 10000
# Total: 000009988
# Min Latencies: 00038
# Avg Latencies: 00080
# Max Latencies: 00407
# Histogram Overflows: 00012
Performance counter stats for
'./cyclictest -p 90 -c 0 -i 3000 -n -h 250 -q -l 10000':
772.978000 task-clock (msec) # 0.026 CPUs utilized
13,363 context-switches # 0.017 M/sec
0 cpu-migrations # 0.000 K/sec
66 page-faults # 0.085 K/sec
444,135,743 cycles # 0.575 GHz (41.26%)
271,762,254 stalled-cycles-frontend # 61.19% frontend cycles idle (48.87%)
8,522,179 stalled-cycles-backend # 1.92% backend cycles idle (56.53%)
65,640,536 instructions # 0.15 insns per cycle
# 4.14 stalled cycles per insn (37.62%)
7,453,674 branches # 9.643 M/sec (34.44%)
1,584,489 branch-misses # 21.26% of all branches (25.24%)
30.197211000 seconds time elapsed
看起来Max latencies会因为-m变小一点
我的问题在于,page-faults只有因为-m变稍小一点,并没有完全解决
请问这是正常的吗?我还以为mlockall住就不会有PF了。
感谢