写个了小程序试着在memory_only下分配超过100MB的内存,结果每次都能成功,百思不得其姐,岂不是违背了资源隔离的本意?
原来是这个原因,
"Looks like I didn't have memory isolation enabled. I needed to enable
CONFIG_MEMCG, and now things work (without the symlinks). For
reference, here's my full kernel config "
https://groups.google.com/forum/#!topic/lmctfy/GKzhuElgq2A
https://wiki.gentoo.org/wiki/Lmctfy
简单的了解了一下memory isolation,其实是Memory Resource Controller for Control Groups,具体内容参考
https://www.kernel.org/doc/Documentation/cgroups/memory.txt
a. Isolate an application or a group of applications Memory-hungry applications can be isolated and limited to a smaller amount of memory. b. Create a cgroup with a limited amount of memory; this can be used as a good alternative to booting with mem=XXXX. c. Virtualization solutions can control the amount of memory they want to assign to a virtual machine instance. d. A CD/DVD burner could control the amount of memory used by the rest of the system to ensure that burning does not fail due to lack of available memory. e. There are several other use cases; find one or use the controller just for fun (to learn and hack on the VM subsystem).