The loop driver takes a copy of the data which it is writing. When this
happens on the try_to_free_pages() path, loop can easily consume ALL memory
and bio_copy() will fail to allocate a page.
Loop forgets to check the bio_copy() return value and oopses.
Fix this by dropping PF_MEMALLOC and throttling to the block writeout speed.
The patch exports blk_congestion_wait() to modules for this. This is a
needed export: several filesystems have a "try to allocate and yield if it
failed" loop and blk_congestion_wait() is a more appropriate way of
implementing the sleep in this situation.