Write module of kernel (Linux), which to save the page of process from removing to the swap

て烟熏妆下的殇ゞ 提交于 2020-01-06 19:59:09

问题


Need to save the page of process (the user part!) from removing to the swap.

I need to do it in the kernel, only. (language C I know)

(Maybe insert hook in shrink_page_list?)

I have IDs of processes, which need to save and threshold amount of physical memory in the system (We fill, while it isn't filled). IDs and threshold write in /proc, /dev or /sys.

How to approach this?

What files to look at?

What tutorials to read?

Maybe there are examples that are somehow are related with this task.

Info: I compilling kernel of Debian Lenny, use Qemu for start it on my Ubuntu.


回答1:


See get_user_pages. http://www.makelinux.net/ldd3/chp-15-sect-3.

Use get_user_pages, you can get whatever page you want and keep it locked in memory.

Even better, look at the comments on the source at http://lxr.free-electrons.com/source/mm/gup.c#L637



来源:https://stackoverflow.com/questions/13452587/write-module-of-kernel-linux-which-to-save-the-page-of-process-from-removing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!