Re: System freezes after OOM
From: David Rientjes
Date: Wed Jul 13 2016 - 19:53:44 EST
On Wed, 13 Jul 2016, Mikulas Patocka wrote:
> What are the real problems that f9054c70d28bc214b2857cf8db8269f4f45a5e23
> tries to fix?
>
It prevents the whole system from livelocking due to an oom killed process
stalling forever waiting for mempool_alloc() to return. No other threads
may be oom killed while waiting for it to exit.
> Do you have a stacktrace where it deadlocked, or was just a theoretical
> consideration?
>
schedule
schedule_timeout
io_schedule_timeout
mempool_alloc
__split_and_process_bio
dm_request
generic_make_request
submit_bio
mpage_readpages
ext4_readpages
__do_page_cache_readahead
ra_submit
filemap_fault
handle_mm_fault
__do_page_fault
do_page_fault
page_fault
> Mempool users generally (except for some flawed cases like fs_bio_set) do
> not require memory to proceed. So if you just loop in mempool_alloc, the
> processes that exhasted the mempool reserve will eventually return objects
> to the mempool and you should proceed.
>
That's obviously not the case if we have hundreds of machines timing out
after two hours waiting for that fault to succeed. The mempool interface
cannot require that users return elements to the pool synchronous with all
allocators so that we can happily loop forever, the only requirement on
the interface is that mempool_alloc() must succeed. If the context of the
thread doing mempool_alloc() allows access to memory reserves, this will
always be allowed by the page allocator. This is not a mempool problem.