Re: [PATCH] squashfs: enable __GFP_FS in ->readpage to prevent hang in mem alloc

From: Michal Hocko
Date: Mon Dec 17 2018 - 04:33:42 EST


On Sun 16-12-18 19:51:57, Matthew Wilcox wrote:
[...]
> Ah, yes, that makes perfect sense. Thank you for the explanation.
>
> I wonder if the correct fix, however, is not to move the check for
> GFP_NOFS in out_of_memory() down to below the check whether to kill
> the current task. That would solve your problem, and I don't _think_
> it would cause any new ones. Michal, you touched this code last, what
> do you think?

What do you mean exactly? Whether we kill a current task or something
else doesn't change much on the fact that NOFS is a reclaim restricted
context and we might kill too early. If the fs can do GFP_FS then it is
obviously a better thing to do because FS metadata can be reclaimed as
well and therefore there is potentially less memory pressure on
application data.
--
Michal Hocko
SUSE Labs