On Tue, Dec 10, 2013 at 03:55:48PM -0800, David Rientjes wrote: > > Okay, are you saying that userland OOM handlers will be able to dip > > into kernel reserve memory? Maybe I'm mistaken but you realize that > > that reserve is there to make things like task exits work under OOM > > conditions, right? The only way userland OOM handlers as you describe > > would work would be creating a separate reserve for them. > > > > Yes, PF_OOM_HANDLER processes would be able to allocate this amount as > specified by memory.oom_reserve_in_bytes below the per-zone watermarks and > the amount of reserves can already be controlled via min_free_kbytes, > which we already increase internally for thp. THP increased min_free_kbytes for external fragmentation control as it reduces the amount of mixing of the different migrate types within pageblocks. It was not about reserves, increasing reserves was just the most straight forward way of handling the problem. This dicussion is closer to swap-over-network than to anything THP did. Swap-over-network takes care to only allocate memory for reserves if it the allocation was required for swapping and reject all other allocation requests to the extent they can get throttled in throttle_direct_reclaim. Once allocated from reserves for swapping, care is taken that the allocations are not leaked to other users (e.g. is_obj_pfmemalloc checks in slab). It does not look like PF_OOM_HANDLER takes the same sort of care. Even if it did, it's not quite the same. swap-over-network allocates from the zone reserves *only* the memory required to writeback the pages. It can be slow but it'll make forward progress. A userspace process with special privileges could allocate any amount of memory for any reason so it would need a pre-configured and limited reserve on top of the zone reserves or run the risk of livelock. -- Mel Gorman SUSE Labs -- 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>