[PATCH] fs: fix schedule while atomic caused by gfp of erofs_allocpage

Gao Xiang hsiangkao at linux.alibaba.com
Tue Jul 16 17:47:09 AEST 2024



On 2024/7/16 15:41, Zhaoyang Huang wrote:
> On Tue, Jul 16, 2024 at 2:50 PM Gao Xiang <hsiangkao at linux.alibaba.com> wrote:
>>
>>
>>
>> On 2024/7/16 14:46, Gao Xiang wrote:
>>>
>>>
>>> On 2024/7/16 14:43, Zhaoyang Huang wrote:
>>>> On Tue, Jul 16, 2024 at 2:20 PM Gao Xiang <hsiangkao at linux.alibaba.com> wrote:
>>>>>
>>>>>
>>>>>
>>>
>>> ...
>>>
>>>>>>>
>>>>>>> I don't see why it's an atomic context,
>>>>>>> so this patch is incorrect.
>>>>>> Sorry, I should provide more details. page_cache_ra_unbounded() will
>>>>>> call filemap_invalidate_lock_shared(mapping) to ensure the integrity
>>>>>> of page cache during readahead, which will disable preempt.
>>>>>
>>>>> Why a rwsem sleepable lock disable preemption?
>>>> emm, that's the original design of down_read()
>>>
>>> No.
>>>
>>>>
>>>>> context should be always non-atomic context, which is applied
>>>>> to all kernel filesystems.
>>>>    AFAICT, filemap_fault/read have added the folios of readahead to page
>>>> cache which means the aops->readahead basically just need to map the
>>>> block to this folios and then launch the bio. The erofs is a little
>>>> bit different to others as it has to alloc_pages for decompression
>>>> when doing this.
>>>
>>> Interesting.  The whole .readahead is sleepable, including
>>> submit block I/Os to storage.
>>
>> Also, please don't imagine your stack trace if it's a non-upstream
>> kernel.
> ok, it should be caused by a vendor hook function of the android
> system. sorry for interrupting by my stupid.

okay, thanks for confirmation.

Also more words may be useful here:  Note that .readahead doesn't
just map the block to this folios.  Even an uncompressed fs could
allocate/read (submit+wait) meta folio/blocks to get the block
mapping from these meta blocks and sleep in this context.

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list