On Thu, Mar 28, 2024 at 09:27:31AM +0800, Zhaoyang Huang wrote: > ok, I missed the refcnt from alloc_pages. However, I still think it is > a bug to call readahead_folio in read_pages as the refcnt obtained by > alloc_pages should be its final guard which is paired to the one which > checked in shrink_folio_list->__remove_mapping->folio_ref_freeze(2)(this > 2 represent alloc_pages & page cache). If we removed this one without __remove_mapping() requires that the caller holds the folio locked. Since the readahead code unlocks the folio, __remove_mapping() cannot be run because the caller of __remove_mapping() will wait for the folio lock.