On 2022/2/16 4:09, Matthew Wilcox wrote: > On Tue, Feb 15, 2022 at 03:45:34PM +0800, Miaohe Lin wrote: >>> @@ -309,7 +288,10 @@ int invalidate_inode_page(struct page *page) >>> return 0; >>> if (page_mapped(page)) >>> return 0; >>> - return invalidate_complete_page(mapping, page); >> >> It seems the checking of page->mapping != mapping is removed here. >> IIUC, this would cause possibly unexpected side effect because >> swapcache page can be invalidate now. I think this function is >> not intended to deal with swapcache though it could do this. > > You're right that it might now pass instead of being skipped. > But it's not currently called for swapcache pages. If we did want AFAICS, __soft_offline_page might call invalidate_inode_page for swapcache page. It only checks !PageHuge(page). Maybe __soft_offline_page should change to check the flag or maybe it's fine to invalidate swapcache page there. I'm not sure... > to prohibit swapcache pages explicitly, I'd rather we checked the > flag instead of relying on page->mapping != page_mapping(page). Agree. > The intent of that check was "has it been truncated", not "is it > swapcache". Many thanks for clarifying this. > > > . >