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/m.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燈, 水草

請輸入看板名稱,例如:Tech_Job站內搜尋

TOP