On Sat, 14 Nov 2015 17:23:15 +0900 Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote: > On 2015/11/13 5:55, 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? > > I use SystemTap for injecting memory allocation failure. > > http://lkml.kernel.org/r/201503182136.EJC90660.QSFOVJFOLHFOtM@xxxxxxxxxxxxxxxxxxx > > > > > 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. > > > > see: > > https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/mm/slab_bulk_test04_exhaust_mem.c > > > > I think you can test the error code-path in kmem_cache_alloc_bulk as > well. Yes, making __alloc_pages_nodemask() fail should propagate all the way back into kmem_cache_alloc_bulk(). I do like your approach, but I think my use-case can be covered by CONFIG_FAIL_PAGE_ALLOC (which like you, also hook into __alloc_pages_nodemask). Although it seems I have more control with your approach, to filter in which situations it should happen in. Thanks for your input! :-) -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat Author of http://www.iptv-analyzer.org LinkedIn: http://www.linkedin.com/in/brouer -- 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>