Re: [PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Qian Cai
On 3/26/19 12:06 PM, Catalin Marinas wrote: > I wonder whether we'd be better off to replace the metadata allocator > with gen_pool. This way we'd also get rid of early logging/replaying of > the memory allocations since we can populate the gen_pool early with a > static buffer. I suppose this is

Re: [PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Michal Hocko
On Tue 26-03-19 16:20:41, Catalin Marinas wrote: > On Tue, Mar 26, 2019 at 09:05:36AM -0700, Matthew Wilcox wrote: > > On Tue, Mar 26, 2019 at 11:43:38AM -0400, Qian Cai wrote: > > > Unless there is a brave soul to reimplement the kmemleak to embed it's > > > metadata into the tracked memory

Re: [PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Qian Cai
On 3/26/19 12:00 PM, Christopher Lameter wrote: >> + */ >> +gfp = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : >> + gfp_kmemleak_mask(gfp) | __GFP_DIRECT_RECLAIM; >> +object = kmem_cache_alloc(object_cache, gfp); >> +} >> + >> if

Re: [PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Catalin Marinas
On Tue, Mar 26, 2019 at 09:05:36AM -0700, Matthew Wilcox wrote: > On Tue, Mar 26, 2019 at 11:43:38AM -0400, Qian Cai wrote: > > Unless there is a brave soul to reimplement the kmemleak to embed it's > > metadata into the tracked memory itself in a foreseeable future, this > > provides a good

Re: [PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Catalin Marinas
On Tue, Mar 26, 2019 at 11:43:38AM -0400, Qian Cai wrote: > Kmemleak could quickly fail to allocate an object structure and then > disable itself in a low-memory situation. For example, running a mmap() > workload triggering swapping and OOM. This is especially problematic for > running things

Re: [PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Matthew Wilcox
On Tue, Mar 26, 2019 at 11:43:38AM -0400, Qian Cai wrote: > Unless there is a brave soul to reimplement the kmemleak to embed it's > metadata into the tracked memory itself in a foreseeable future, this > provides a good balance between enabling kmemleak in a low-memory > situation and not

Re: [PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Christopher Lameter
On Tue, 26 Mar 2019, Qian Cai wrote: > + if (!object) { > + /* > + * The tracked memory was allocated successful, if the kmemleak > + * object failed to allocate for some reasons, it ends up with > + * the whole kmemleak disabled, so let it

[PATCH v3] kmemleaak: survive in a low-memory situation

2019-03-26 Thread Qian Cai
Kmemleak could quickly fail to allocate an object structure and then disable itself in a low-memory situation. For example, running a mmap() workload triggering swapping and OOM. This is especially problematic for running things like LTP testsuite where one OOM test case would disable the whole