Re: [PATCH 1/3] fs: Perform writebacks under memalloc_nofs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 03/22/2018 02:08 AM, Michal Hocko wrote:
> On Wed 21-03-18 17:44:27, Goldwyn Rodrigues wrote:
>> From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx>
>>
>> writebacks can recurse into itself under low memory situations.
>> Set memalloc_nofs_save() in order to make sure it does not
>> recurse.
> 
> How? We are not doing writeback from the direct reclaim context.
> 

I am not sure if I missed a condition in the code, but here is one of
the call lineup:

writepages() -> writepage() -> kmalloc() -> __alloc_pages() ->
__alloc_pages_nodemask -> __alloc_pages_slowpath ->
__alloc_pages_direct_reclaim() -> try_to_free_pages() ->
do_try_to_free_pages() -> shrink_zones() -> shrink_node() ->
shrink_slab() -> do_shrink_slab() -> shrinker.scan_objects() ->
super_cache_scan() -> prune_icache_sb() -> fs/inode.c:dispose_list() ->
evict(inode) -> evict_inode() for ext4 ->  filemap_write_and_wait() ->
filemap_fdatawrite(mapping) -> __filemap_fdatawrite_range() ->
do_writepages -> writepages()

Please note, most filesystems currently have a safeguard in writepage()
which will return if the PF_MEMALLOC is set. The other safeguard is
__GFP_FS which we are trying to eliminate.


-- 
Goldwyn




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux