[Paper] - An Evolutionary Study of Linux Memory Management for Fun and Profit

Memory management主要的功能是page mapping, memory protection, and sharing, 但隨著時間不斷的演進已經算是kernel裡不小的subsystem. 這份研究分析2009~2015年之間4587筆有關memory management(mm)的patches, Linux版本由v2.6.32.1 ~ v4.0-rc4. Source: An Evolutionary Study of Linux Memory Management for Fun and Profit Memory Bugs 5種bugs存在mm: memory error, checking, concurrency, logic and programming. 透過heat map可清楚看到主要bug發生地方 主要的bug fix在: Memory Allocation, Garbage Collection (GC), Virtual Memory Management. 大部份memory leak並不是因為忘了free, 而是錯誤的page fault handling和 free page的計算. MM較大的問題是很難去track正確的狀態. Memory optimization 定義3種optimization patches data structure: 避免nested data structure. Scalability的實現, scalability問題是因為locking for atomic access to shared data structures....

June 13, 2017 · 2 min · oopsmonk

RaspberryPi3: GLMark2 using weston with DRM backend

How to use weston with DRM backend in Raspbian, and gets benchmark score by GLMark2. With regards to hardware acceleration, We can enable VC4 driver through raspi-config. # update system and raspi-config script $ sudo apt-get update && sudo apt-get upgrade $ sudo apt-get install raspi-config # enable Broadcom VC4 driver $ sudo raspi-config Advanced Options -> GL Driver -> GL (Full KMS) Test environment: 2017-04-10-raspbian-jessie-lite HDMI 1080P 60Hz CPU/GPU use default settings(no overclock) Test packages:...

June 5, 2017 · 7 min · oopsmonk

LGS Hell

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! 主要在了解linux graphic system架構, 並分析wayland weston compositor/glmark2的repaint flow. Week18 (05/05) 網路文章 和百年公斤原器說再見!七大國際單位制將改頭換面 原來用抽像來定義實體早己行之有年. 網路資源 C++ Language Interface Foundation (CLIF) Google 做了一個C++ wrapper generator, 目前看來只for Python, 目標是支援更多的語言. Week19 (05/12) 網路文章 Weston repaint scheduling Week20 (05/19) Wayland的weston compositor可透過wesgr來分析repaint過程. glmark2-es2-wayland 加入debug去看glmark repaint過程 [18:50:21.959] canvas_clear 1510 us [18:50:21.960] scenc_draw 389 us [18:50:21.960] scenc_update 159 us [18:50:21.960] weston weston_output_repaint[+] [18:50:21.960] weston surface_flush_damage [18:50:21.960] weston surface_flush_damage [18:50:21.961] weston surface_flush_damage [18:50:21.961] weston surface_flush_damage [18:50:21....

May 31, 2017 · 1 min · oopsmonk

Linux Graphic Stack相關的名詞

Linux graphic 架構還滿複雜的, 在看時需要大略了解几個名詞及之間的關係. X Window System: 目前來到第11版本所以叫X11, 是以X window System Core protocol為基礎的window system. wayland: 由於X11太過複雜且在embbeded system中的效能不佳, 用來取代X window System Core protocol. weston (wayland compositor): 以wayland protocol來實做的compositor做為參考的範例, 實用上會用Westeros, Clutter…等. KMS/UMS: Kernel mode-setting 及User mode-setting. OpenGL: 由Khronos Group制定的跨平台graphic API. GLX: 是一個extension, 做為OpenGL與X window system之間的橋樑. 就像embedded system的EGL, MacOS的AGL. DRM(Direct Rendering Manager): 為了防止世界被破壞, 保護世界的和平. 防止同時使用graphic buffer. DRI(Direct Rendering Infrastructure): Mesa及DRM之間的橋樑. Ref: Introduction to the Direct Rendering Infrastructure CRTC (CRT Controller): Crtc is in charge of reading the framebuffer memory and routes the data to an encoder....

May 30, 2017 · 1 min · oopsmonk

Enable gzip compression in Nginx

How to enable and test gzip in Nginx. Official document: ngx_http_gzip_module Enable gzip I use Raspberry Pi System Monitor to test gzip module. Modify /etc/nginx/sites-available/default to enable gzip. In this case I only change the RpiMonitor website in the server, you can apply it to global by /etc/nginx/nginx.conf location /rpi { proxy_pass http://127.0.0.1:9999/RpiMonitor; } Change to location /rpi { proxy_pass http://127.0.0.1:9999/RpiMonitor; gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; gzip_proxied any; } Then reload nginx....

May 19, 2017 · 1 min · oopsmonk

失速列車

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! 失速的這個月 Week14 (04/07) 網路文章 Adding A New System Service To Android 5: Tips and How To 由下到上打造一個android system service. HW -> HAL -> JNI -> Service -> Manager -> Registering. Adding New System Service in Android Native system service. 33 Foods that Starve Cancer 滿有趣的論點, 細胞沒有supplement會死亡沒錯, 但microscopic cancers能否自己生出新的血管? 大部份的癌症無關基因, 超過40歲體內難免會有microscopic cells, 並可能轉變成cancer cells? Week15 (04/14) img2ascii.py 參考網路上的做法, 加了些參數方便調整輸出的內容. pillow提供便利的API. 網路文章 Every attempt to manage academia makes it worse...

April 28, 2017 · 2 min · oopsmonk

Android USB Media Transfer Protocol(MPT)

Study USB MTP Device and Host mode in Android M. Source Code Cross Reference: Android 6.0.1_r10 MTP Device Mode Enable device mode: Settings -> Developer options -> Select USB Configuration -> MTP UsbDeviceManager: Setting USB config to mtp device/lge/hammerhead/init.hammerhead.usb.rc : on property:sys.usb.config=mtp system/core/rootdir/init.usb.configfs.rc: on property:sys.usb.config=mtp && property:sys.usb.configfs=1 USB plug to PC: MtpReceiver: listen to android.hardware.usb.action.USB_STATE and bring up MtpService UsbDeviceManager: get uevent USB_STATE=CONFIGURED from kernel MtpService: create MtpDatabase MtpDatabase: create volume and storage path...

April 18, 2017 · 2 min · oopsmonk