LinuxDev 板


LINE

正在试着评估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了。 感谢 --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 90.41.67.118
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/LinuxDev/M.1446054583.A.EB6.html
1F:推 yvb: 光载入程式本身text和libs, 就会发生很多次 page-faults 了. 10/29 16:24
2F:→ wtchen: 所以除了一开始initialize的部份以外,就不会再有PF了吗? 10/29 19:28
做了个实验:把loop提高10倍看PF次数有没有提高 有mlockall的情况下:page-faults维持在55-56没增加 Performance counter stats for './cyclictest -p 90 -m -c 0 -i 3000 -n -h 250 -q -l 100000': 7202.248000 task-clock (msec) # 0.024 CPUs utilized 130,818 context-switches # 0.018 M/sec 0 cpu-migrations # 0.000 K/sec 55 page-faults # 0.008 K/sec 4,079,431,733 cycles # 0.566 GHz (48.12%) 2,569,771,515 stalled-cycles-frontend # 62.99% frontend cycles idle (49.99%) 69,883,756 stalled-cycles-backend # 1.71% backend cycles idle (51.78%) 643,633,565 instructions # 0.16 insns per cycle # 3.99 stalled cycles per insn (34.40%) 72,253,517 branches # 10.032 M/sec (32.91%) 15,166,468 branch-misses # 20.99% of all branches (31.47%) 300.240982143 seconds time elapsed 没有mlockall:page-faults维持在66-67 Performance counter stats for './cyclictest -p 90 -c 0 -i 3000 -n -h 250 -q -l 100000': 7181.634000 task-clock (msec) # 0.024 CPUs utilized 130,892 context-switches # 0.018 M/sec 0 cpu-migrations # 0.000 K/sec 67 page-faults # 0.009 K/sec 4,072,629,665 cycles # 0.567 GHz (49.76%) 2,537,027,318 stalled-cycles-frontend # 62.29% frontend cycles idle (49.79%) 70,191,503 stalled-cycles-backend # 1.72% backend cycles idle (50.05%) 627,997,620 instructions # 0.15 insns per cycle # 4.04 stalled cycles per insn (34.31%) 71,914,012 branches # 10.014 M/sec (33.07%) 15,190,645 branch-misses # 21.12% of all branches (33.44%) 300.195795144 seconds time elapsed 看起来loop增加并没有增加page-faults... (不管有无mlockall) ※ 编辑: wtchen (90.41.214.241), 10/29/2015 19:46:17 ※ 编辑: wtchen (90.41.214.241), 10/29/2015 19:51:13
3F:推 yvb: ...... 你认为什麽情况下会发生 page fault ? 10/29 21:58
4F:→ wtchen: 我以为当process因为sleep或time slice超过後 10/30 04:00
5F:→ wtchen: 被swap,之後重新回到memory才会有page fault的动作 10/30 04:01
6F:→ wtchen: mlockall我看man,他的功用是 10/30 04:02
7F:→ wtchen: preventing that memory from being paged to the swap 10/30 04:02
8F:→ wtchen: 所以我以为mlockall = no swap 10/30 04:04
9F:→ yvb: 你可能把 swapping (paging) 和 context switching 搞混了... 10/30 16:51
10F:→ yvb: 要不要看一下 wikipedia 的资料, 或用 google 确认一下差别? 10/30 16:51
11F:→ final01: page fault是应该减少没错,可是cold page fault无法免 10/31 00:00
12F:→ wtchen: 我有一点混淆没错,不过我的用意是不要loop到一半 10/31 00:06
13F:→ wtchen: sleep的时候variable被丢到swap,结果sleep完 10/31 00:07
14F:→ wtchen: 要找variable找不到而发生page fault 10/31 00:07
15F:→ wtchen: 这样从swap->RAM就要浪费时间load,使得timing不准确 10/31 00:08
16F:推 yvb: 除非主记忆体不足, kernel 不会没事乱搞 swapping... 11/07 05:35
17F:→ yvb: 至於 timing 准不准确, 得看需要的精确度有多高... 11/07 05:36
18F:→ yvb: 不同 CPU 做 context switching 的 overhead 也不同. 11/07 05:37







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:WOW站内搜寻

TOP