Re: System freezes after OOM

From: Michal Hocko
Date: Thu Jul 14 2016 - 13:39:12 EST


On Thu 14-07-16 19:36:59, Michal Hocko wrote:
> On Thu 14-07-16 19:07:52, Ondrej Kozina wrote:
> > On 07/14/2016 05:31 PM, Michal Hocko wrote:
> > > On Thu 14-07-16 16:08:28, Ondrej Kozina wrote:
> > > [...]
> > > > As Mikulas pointed out, this doesn't work. The system froze as well with the
> > > > patch above. Will try to tweak the patch with Mikulas's suggestion...
> > >
> > > Thank you for testing! Do you happen to have traces of the frozen
> > > processes? Does the flusher still gets throttled because the bias it
> > > gets is not sufficient. Or does it get throttled at a different place?
> > >
> >
> > Sure. Here it is (including sysrq+t and sysrq+w output): https://okozina.fedorapeople.org/bugs/swap_on_dmcrypt/4.7.0-rc7+/1/4.7.0-rc7+.log
>
> Thanks a lot! This is helpful.
> [ 162.716376] active_anon:107874 inactive_anon:108176 isolated_anon:64
> [ 162.716376] active_file:1086 inactive_file:1103 isolated_file:0
> [ 162.716376] unevictable:0 dirty:0 writeback:69824 unstable:0
> [ 162.716376] slab_reclaimable:3119 slab_unreclaimable:24124
> [ 162.716376] mapped:2165 shmem:57 pagetables:1509 bounce:0
> [ 162.716376] free:701 free_pcp:0 free_cma:0
>
> No surprise that PF_LESS_THROTTLE didn't help. It gives some bias but
> considering how many pages are under writeback it cannot possibly help
> to prevent from sleeping in throttle_vm_writeout. I suppose adding
> the following on top of the memalloc patch helps, right?
> It is an alternative to what you were suggesting in other email but
> it doesn't affect current_may_throttle paths which I would rather not
> touch.

Just read the other email and your patch properly and this is basically
equivalent thing. I will think more about potential issues this might
cause and send a proper patch for wider review.

> ---
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 7fbb2d008078..a37661f1a11b 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -1971,6 +1971,9 @@ void throttle_vm_writeout(gfp_t gfp_mask)
> unsigned long background_thresh;
> unsigned long dirty_thresh;
>
> + if (current->flags & PF_LESS_THROTTLE)
> + return;
> +
> for ( ; ; ) {
> global_dirty_limits(&background_thresh, &dirty_thresh);
> dirty_thresh = hard_dirty_limit(&global_wb_domain, dirty_thresh);
> --
> Michal Hocko
> SUSE Labs

--
Michal Hocko
SUSE Labs