]> git.baikalelectronics.ru Git - kernel.git/commit
mm/truncate: Replace page_mapped() call in invalidate_inode_page()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 12 Feb 2022 22:43:16 +0000 (17:43 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 21 Mar 2022 16:59:01 +0000 (12:59 -0400)
commit7d4b29c78813c3c8f9d8789529a4a33f3c7c69ed
tree4337c6160315b516d9c58241832a235f6656a93f
parent8d5ed03b21f777d44c111852dd3edba0dfb6731e
mm/truncate: Replace page_mapped() call in invalidate_inode_page()

folio_mapped() is expensive because it has to check each page's mapcount
field.  A cheaper check is whether there are any extra references to
the page, other than the one we own, one from the page private data and
the ones held by the page cache.

The call to remove_mapping() will fail in any case if it cannot freeze
the refcount, but failing here avoids cycling the i_pages spinlock.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
mm/truncate.c