kswapd0挖礦
① linux top 的 負載 超大 是因為什麼 (帶詳細數據)
平均負載指的是特定時間間隔內CPU的運行隊列中的平均進程數,所以單位就是個數了。這個值一般不應該大於2,否則就是系統比較繁忙了。
② linux怎樣讀取memory spd
smbus設備的bar5一般為smbus設備的io基地址。可以通過設備管理器查看。
Read SPD information
The SMBus DeviceID of memory bank0 is a0, bank1= 0xa2, and bank2 =0xa4
smbus操作的過程如下所示
a. start out Base+0, 1e
b. wait smbus ready
c. output Base+04, (DeviceID+1)
d. out Base+03, offset
e. out Base+02, 48H
f. wait 200ms
g. wait smbus ready
h. input base+05
i. OK
How to wait SMBus ready? Input Base+0, bit0==0 indicates smbus is ready, otherwise(bit0==1), smbus is busy
下面為轉載的全文。
思路有了就是不知道怎麼實現,請大家幫忙,引用系統軟體開發 System Programming中的文章:
怎樣讀寫SMBus上的Device―以獲取Intel平台上Memory的SPD信息為例
How to access devices on SMBus--- Take reading SPD information (Intel platform) as example
firing -2005/04/13
0. Essential skills before you start:
l How to read/write PCI configuration space?
l How to read/write I/O space under WindowsNT/2000… platform?
And an Intel south bridge datasheet as reference
1. Basic steps
a. Enable SMBus controller
b. Get SMBus base address
c. Read SPD information, according the device IDs
2. Enable SMBus controller
LPC Interface Bridge Registers (D31:F0), Offset: F2h (FUNC_DIS),Bit3 :
Software sets this bit to disable the SMBus Host controller function.
0 = SMBus controller is enabled
1 = SMBus controller is disabled
This bit is set to 1(SMBus controller is disabled) by default. So, just set this bit to 0.
(How to make sure you have enabled SMBus controller? Go to 『Device Manager』 and refresh it, and then check 『System Device』, where you should find a PCI device named 「Intel® 82801DB SMBus Controller」 like.)
3. Get SMBus base address
SMBus Controller PCI Register (D31:F3), offset: 20~23H. That』s the SMBus base address. Just read this base address. Normally, the address could be 0x500 or 0x5000
4. Read SPD information
The SMBus DeviceID of memory bank0 is a0, bank1= 0xa2, and bank2 =0xa4
a. start
b. wait smbus ready
c. output Base+04, (DeviceID+1)
d. out Base+03, offset
e. out Base+02, 48H
f. wait 200ms
g. wait smbus ready
h. input base+05
i. OK
Note:
How to wait SMBus ready? Input Base+0, bit0==0 indicates smbus is ready, otherwise(bit0==1), smbus is busy
③ linux cpu佔用較高
Linux伺服器上出現CPU負載達到100%居高不下的情況,如果CPU 持續跑高,則會影響業務系統的正常運行; CPU利用率。根據經驗來看,用戶空間進程佔用CPU比例在 65-70%。一般不能超過這個比例,超過這個比例,系統性能就會降低,平均負載升高,這點將會在下面的測試中看到。
進程上下文切換。上下文切換和CPU利用率應該聯系起來,如果CPU利用率低,那麼上下文切換稍高點也能接受。上下文切換也是需要消耗CPU資源的,頻繁的切換必將使得CPU利用率升高。
運行隊列中等待運行的進程數。每個CPU核心中等待處理的進程數不應該超過3個線程/進程。如4核心的機器,那麼隊列的最大值應該不超過12個。
對於CPU過載問題通常使用以下兩種方式即可快速定位(不能涵蓋所有特殊情況,請作為其中的參考排查思路):
一、排查分析
方法一(針對JAVA應用):
第一步:使用
top命令,然後按shift+p按照CPU排序
找到佔用CPU過高的進程的pid
第二步:使用
top -H -p [進程id]
找到進程中消耗資源最高的線程的id
第三步:使用
echo 'obase=16;[線程id]' | bc或者printf "%x\n" [線程id]
將線程id轉換為16進制(字母要小寫)
bc是linux的計算器命令
第四步(此步驟可以和相對應的java開發進行一起排查):執行
jstack [進程id] |grep -A 10 [線程id的16進制]」
查看線程狀態信息
二、kswapd0 進程佔用 CPU 較高
操作系統都用分頁機制來管理物理內存,操作系統將磁碟的一部分劃出來作為虛擬內存,由於內存的速度要比磁碟快得多,所以操作系統要按照某種換頁機制將不需要的頁面換到磁碟中,將需要的頁面調到內存中,由於內存持續不足,這個換頁動作持續進行,kswapd0 是虛擬內存管理中負責換頁的,當伺服器內存不足的時候 kswapd0 會執行換頁操作,這個換頁操作是十分消耗主機 CPU 資源的。如果通過 top 發現該進程持續處於非睡眠狀態,且運行時間較長,可以初步判定系統在持續的進行換頁操作,可以將問題轉向內存不足的原因來排查。
④ 手機耗電多的kswapd0是什麼軟體
手機正常待機時間大約1天左右。手機待機時長與電池容量、個人使用習慣、網路質量等有關。如上網、看視頻、玩游戲等相對比較耗電。以下為您提供幾種延長手機待機時間的方法,請您參考:
1.藍牙、WLAN、GPS、照相機、瀏覽器等相關應用程序,這些功能使用完成後建議您及時關閉。
2.開啟手機的省電模式或者超級省電模式。
3.減少背景燈時間。
4.調低顯示屏的亮度。
⑤ kswapd0 這個是什麼進程
採用hugepage,關閉11G的amm。自己看看網上很多帖子講如何實現的。
我們也遇到這個問題,TMD連接數達到36xx。採用後問題緩解,btw我們是10g。
11G採用hugepage有點麻煩,你可以在出現問題時看看:
# cat /proc/meminfo | grep -i page
AnonPages: 12529120 kB
PageTables: 751540 kB
AnonHugePages: 16384 kB
HugePages_Total: 6000
HugePages_Free: 2159
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
看看PageTables有多大。
如果不這樣,可以減少sga的大小看看情況是否好轉。