找回密碼
 註冊
搜索
查看: 2673|回復: 0

[教學] Swappolube from extras-devel 系統內存優化 (10/1更新)

[複製鏈接]
發表於 18-10-2010 14:29:13 | 顯示全部樓層 |閱讀模式
文章出自:
5 W8 l" _0 ]' c7 h# F(sonarsu) http://www.maemoers.com/thread-6106-1-12.html. _2 }# D  ~" O$ m/ A  S4 u3 H
http://discussions.europe.nokia.com/t5/Maemo-Devices/Make-your-N900-faster-with-Swappolube/m-p/764001
& B+ B; p' C% J, g: i5 U! P- V8 P0 b3 w0 D' [) }

( g7 H% i& t; Y& L: B9 ]5 h/ Q打開 x-terminal 執行:- e, ]- O- F% F6 C0 w+ o
sudo gainroot
) B/ s, R$ D/ a0 `: W* Capt-get install swappolube 安裝這個軟件,但目錄底下還是請務必加上extras-devel這個來源
/ J8 r8 F1 U& Z9 ]( A# _- h
  g' r' V  l. w$ n& g第一次發帖,很多事情沒考慮清楚,請各位前輩多多見諒.! F! U0 W: r" A, n* w0 y
1.安裝完畢後,會出現這個程序 swappolube,您打開後您會發現原先是
# V* r* F* n5 B. @( `100 Swappiness7 \# _% `, |+ @+ ?+ ?  j
40 Dirty Ratio
5 Q* R: G) _1 C( ^: j3 T10 dirty BGD ratio
8 H9 ~3 k4 S' d2 L. M; U$ c3 M500 Dirty Expire Centisecs
- b6 S1 \5 B# z. s& i500 Dirty Writeback Centisecs
" }$ x: H7 S" Y( c% L5 Page-Cluster  a4 C5 W4 v. w' J/ o
右方顯示0等等資訊4 d6 T/ s9 l- j# L, J' Y: I
* T' O& ]1 w7 \9 t& F
( u5 V: f  l% a, b, o: [) R9 f
最快速的調整參數請參照,這樣調整就可以了& {. p( I# o' K% E- I* V
" b" Z) I5 h; L+ _0 C6 s. F
順序為 1.proposed  2.apply  3.store  ,  4.開機後重新打開程序看有沒有跑掉參數
" l9 f* D! o3 d0 b4 ^
# y; w9 g* B: M% U圖中select是要改變時勾選
7 v2 F1 s( A6 q4 u9 F+ X$ u- K# b4 f5 E6 N3 O& [9 S1 l
建議還是以NOKIA SUPPORT上面的參數來設定,簡單明瞭
) N6 n/ Q& t! Z1 a. Y
  i9 Z% P$ f# x! u9 f. x& k好處是:
& W# Q1 `2 g! u& h6 C5 o1.不必超頻就可以讓系統內存最佳化,跑得飛快,不必那麼卡卡的,誰說N900笨重又慢的?5 a: V5 C1 L4 R: E& n
2.耗電量測試的結果,比起未安裝前只有多那麼一點點,也不會像是超頻這麼熱,效果卻是不錯的,沒跑3D Game的情況下,這個優化效果不錯,但是這裡需要強調是並非萬靈丹,有某些程式你不跑超頻光靠內存的排擠與優化還是跑不順,建議適當的超頻運用起來更好(2010-10-08修正)
+ @* Z$ J% l) `" I9 Q3.對網路瀏覽優化,一,系統會背地裡幫大家做好,瀏覽更順了
. `* ^2 N6 ^- X4 M; a( q: q
2 y$ F5 H" N) Z, F/ C+ P疑問回答:$ N# X$ Q, p1 d. m' U! h5 B  M* U, c+ E- @
1.電池的電力不會變得耗電,測試過三天跟之前無明顯變化,不會特別耗電4 D) M3 G: \3 t( k. k+ _! @
2.rootfs太低也不會使得系統快到哪裡去,只好期待新的韌體更新,多多用conky注意安裝軟件時佔用rootfs的狀況,沒依照規範寫的程式就別裝了,會拖慢系統
8 r) u: C$ B/ N3.更改後 apply->store 重開機再來看看有沒有儲存進去以下提供手動方法,利用xterm輸入或包裝成script執行
+ n+ H. s* E2 Fecho "30" > /proc/sys/vm/swappiness        
, n% [8 }( o$ J8 ^$ g) B9 V" iecho "0" > /proc/sys/vm/page-cluster        : [2 c! d, l5 g/ P
echo "1" > /proc/sys/vm/laptop_mode          E5 O3 U6 F5 i+ g+ f5 B, H$ `5 Q& w
echo "1" > /proc/sys/vm/oom_kill_allocating_task        % i& C+ W8 Z" l3 N$ ~* `
echo "0" > /proc/sys/vm/dirty_expire_centisecs        
/ v! D  d& D) Secho "0" > /proc/sys/vm/dirty_writeback_centisecs      
) r& p1 L% V% i4 V% ?  Xecho "60" > /proc/sys/vm/dirty_background_ratio        6 Y1 @% u4 V1 l5 e
echo "95" > /proc/sys/vm/dirty_ratio        8 E3 W  g: _$ S& U
echo "0" > /proc/sys/net/ipv4/tcp_timestamps        0 k( N. p8 {1 m' x! K+ \
echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save
: n- f  _( b  h1 v3 T  O利用 cat指令 看看有沒有寫入 例如:cat  /proc/sys/vm/swappiness : f0 e1 G  [  h/ Z
4.這個參數部分可以自己亂試,你愛改多少就改多少,可以去感受一下差異,並不會危及任何硬體及設定
6 b3 M$ o( D) f/ K9 r* e5.這個軟件是針對快取來優化,可以明顯感受速度的差異在於瀏覽時的捲動及關閉程序的速度
6 v( o) @; W7 k$ k- `. L0 C: {2 L針對很頻繁對硬碟快取得非常有效,前輩們可以去測試例如 word to go ,abiword等文書軟件,或針對瀏覽器的捲動及資料顯現來測試有無差異$ V/ i. P; [& w1 e1 Y5 W3 z1 G
6.有些軟件本身啟動上就很慢,例如firefox,測試後差異並不明顯,但資料上呈現還是快些,網路讀取還是要取決於當時網絡狀況
" F2 H" x* ?& w0 t8 u/ s4 ?1 \我本身是使用台灣3.5G,狀況還可以,有感覺變快了,我很難回答大家有沒有對照測試,機器上大家的軟件都安裝的不同,甚至超頻情況有無都不同,僅能在此致歉:opera ,nokia網絡套件開啟時的速度變化來看看差異
5 Y/ S9 G8 r3 o1 B5 T' @$ ]3 _: }' L4 B# t3 G9 |, t# b
當然這個優化程序可以利用指令去修改,以下參數討論給大家參考用,讓高手可以進一步去討論與調整- [+ Q" W5 `: u2 x# _1 F" m/ ?2 D
here are the settings and what they are changed from (the default on the N900) and to(From Nokia Support :cpitchford)
% H# |$ u5 ^. A# @/ E$ _/ }From To Setting' L% P* C% `9 I7 G- t
100 30 /proc/sys/vm/swappiness
+ j/ {/ q0 ^3 Z# \- [' e5 0 /proc/sys/vm/page-cluster
9 S; ]) Z% ]2 [1 y2 }0 1 /proc/sys/vm/laptop_mode
! {8 T* a, @) Z: p* U0 1 /proc/sys/vm/oom_kill_allocating_task  f0 H7 ?/ ~( Z7 }3 U/ k- ?% s
500 0 /proc/sys/vm/dirty_expire_centisecs8 [  a- R' C5 {' C
500 0 /proc/sys/vm/dirty_writeback_centisecs* O( M% M6 v  v# q$ \4 U
10 60 /proc/sys/vm/dirty_background_ratio
3 X( H: O& B$ M# Q0 E40 95 /proc/sys/vm/dirty_ratio
* L; k2 b) _1 L& f1 0 /proc/sys/net/ipv4/tcp_timestamps) i! W' J/ r) b  s/ l0 C0 C: U$ j% }
0 1 /proc/sys/net/ipv4/tcp_no_metrics_save
. X/ `1 Q5 i4 i( ]* f/ X3 U$ e1 S8 f3 M/ a& p, Y

- }$ a) A, t. ^6 `  _3 s* X! U4 {
; N: S# v9 ~! I' E  wI believe this value changes how the system swaps. Memory is in use, in swap, free or disk-cache (more or less) if this value is high, it will push in use memory onto swap to keep the cache large.. if it is low, it will sacrifice cache to keep application in use memory available.. I think
# f8 p$ T- v# G$ N
+ @1 ^4 |- t6 v$ f2 p' U/proc/sys/vm/page-cluster
( d4 b- k( a9 ^& A2 X4 z, P
( U9 o( m# f! v" M& k* ?) GThis controls how big a chunk of memory is moved into swap in one go. Changing from 5 to 0 reduces the size by 32! This means very small chunks can now be put into swap memory, which gives greater control over what is swapped out9 m, U, P+ p  _* B' W
. \: k. N  C, g8 R
/proc/sys/vm/laptop_mode! w, [, |: l, `  d
9 O1 x1 R" H+ w$ t# @. j" q
Laptop mode is about stopping a linux machine spinning up a laptop hard disk unncessarily. When this value is set to one, when something starts writing to the disk (actually the emmc) any page flushing will happen at the same time.. things get moved to swap when other stuff is writing to disk.. Since writing to disk introduces latency, its better to bunch this stuff up..
* E" g0 H/ f5 r$ ?# S0 j
& B. ^* |: l8 _0 z9 i0 _/proc/sys/vm/oom_kill_allocating_task
$ [5 O" s8 z  X' Z9 X: `8 X" v+ q6 U) w& x6 k* C
Seems a bit drastic.. When a process asks for more memory, if the system is full it would normally look for a process to kill (to free up its resources which can then be re-used). When this is change, the system will simply shoot ANY process that tries to request memory when the system is full..
5 M4 L8 C4 t1 _
+ S" i# v% Z8 v9 _' a0 R/proc/sys/vm/dirty_expire_centisecs
: {: U' f" y. q4 D
) d" S: `5 i, u( kHow long stuff can sit in the disk cache before it is written to disk.. 0 means NOW!
0 H- X# Z7 W; j* T4 P8 V
1 G2 L+ z" G) |! i0 Q/proc/sys/vm/dirty_writeback_centisecs1 s# Q! j1 I6 A3 \6 Z

8 k: D- w, c  X/ v4 _$ H; lHow long stuff can sit in the disk cache before it writes stuff to disk.. kind of meaningless now since /proc/sys/vm/dirty_expire_centisecs is set to zero so nothing is going to sit there anyway
' W- O* a7 A- T# J+ J7 _1 e* O' g6 S9 a* m% m$ i
/proc/sys/vm/dirty_background_ratio# |1 L, F  y! ]: e/ \: ?1 Y7 [
/proc/sys/vm/dirty_ratio
, Q2 B2 s' O5 L5 U; M
" J1 p/ {" d* L5 |! ]! p2 o8 PStuff must be written to disk when 60% of the memory is used by disk write cache. Either after a delay or when the process running tries to writing to disk cache
# _# e: K' _9 [1 h& N+ A8 i' v' b0 F4 o  X
% A. F( W) A" a  M7 r, w; f/proc/sys/net/ipv4/tcp_timestamps
7 K/ `( E+ H, }* P% k1 |& uTCP packets are sent include the time they are sent when this is enabled.. Turning it off allows more data to be sent in each packet (as none is now wasted by the timestamp) This is bad for very fast links..1 x' G/ a+ J) J

* H! P2 o9 e$ ?& h/proc/sys/net/ipv4/tcp_no_metrics_save
8 H% D2 s* Z) EThis stops the kernel remembering information about past TCP connections. As well as gaining free memory by disabling this, it also stops the kernel remembering details when the link was congested (eg you went out of 3G coverage for a moment) that might alter how the system communicates in the future..
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|小黑屋|歡迎光臨 Julybee Club

GMT+8, 23-11-2024 10:49 , Processed in 0.537494 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回復 返回頂部 返回列表