On Thu, 12 Nov 2015, Jesper Dangaard Brouer wrote: > Hi MM-people, > > How do you/we test the error paths when the system runs out of memory? > > What kind of tools do you use? > or Any tricks to provoke this? > Depends on the paths that you want to exercise when the system is out of memory :) If it's just to trigger the oom killer, then no kernel module should be necessary if you're not limited by any cgroup and just disable swap and start off an anonymous memory hog that consumes all memory. > For testing my recent change to the SLUB allocator, I've implemented a > crude kernel module that tries to allocate all memory, so I can test the > error code-path in kmem_cache_alloc_bulk. > Trying to exercise certain paths under oom is difficult because the oom killer will usually quickly kill a process or you'll get hung up somewhere else that needs memory before the function you want to test. This is why failslab had been used in the past, and does a good job at runtime testing. My suggestion would just be to instrument the kernel to randomly fail as though the system is oom and ensure that it works. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>