Per process reclaim

2022-05-13 19:41:27 浏览数 (2)

What's the Per process reclaim

These day, there are many platforms avaiable in the embedded market and they are smarter than kernel which has very limited information about working set so they want to involve memory management more heavily like android's lowmemory killer and ashmem or recent many lowmemory notifier(there was several trial for various company NOKIA, SAMSUNG, Linaro, Google ChromeOS, Redhat). One of the simple imagine scenario about userspace's intelligence is thatplatform can manage tasks as forground and backgroud so it would be better to reclaim background's task pages for end-user's *responsibility* although it has frequent referenced pages. Minchan Kim provide these patches in 2013, Whihc adds new knob "reclaim under proc/<pid>/" so task managercan reclaim any target process anytime, anywhere. It could give another method to platform for using memory efficiently. It can avoid process killing for getting free memory, which was really terrible experience if these apps are killed by OOO killer. How it worksReclaim file-backed pages only. echo file > /proc/PID/reclaim Reclaim anonymous pages only. echo anon > /proc/PID/reclaim Reclaim all pages echo all > /proc/PID/reclaim Some pages could be shared by several processes. (ex, libc) In case of that, it's too bad to reclaim them from the beginnig. It can let VM keep them on memory until last task try to reclaim them so shared pages will be reclaimed only if all of task has gone swapping out. Another requirement is per address space reclaim.(By Michael Kerrisk) In case of Webkit1, it uses a address space for handling multi tabs. IOW, it uses *one* process model so all tabs shares address space of the process. In such scenario, per-process reclaim is rather coarse-grained and now supports more fine-grained reclaim for being able to reclaim target address range of the process. For reclaim target range, you should use following format. echo [addr] [size-byte] > /proc/pid/reclaim

0 人点赞