mm/rmap: use page_not_mapped in try_to_unmap()
authorMiaohe Lin <linmiaohe@huawei.com>
Fri, 26 Feb 2021 01:18:03 +0000 (17:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Jul 2021 10:48:10 +0000 (12:48 +0200)
commit1decdcdf8ac3ea56b6001b3c60f35c7b15daabb3
tree96486de3f5bfff561422504ee1f86688c02d52b2
parenta369974d1547fc41bdab5e19186303c0ac31dc5a
mm/rmap: use page_not_mapped in try_to_unmap()

[ Upstream commit b7e188ec98b1644ff70a6d3624ea16aadc39f5e0 ]

page_mapcount_is_zero() calculates accurately how many mappings a hugepage
has in order to check against 0 only.  This is a waste of cpu time.  We
can do this via page_not_mapped() to save some possible atomic_read
cycles.  Remove the function page_mapcount_is_zero() as it's not used
anymore and move page_not_mapped() above try_to_unmap() to avoid
identifier undeclared compilation error.

Link: https://lkml.kernel.org/r/20210130084904.35307-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
mm/rmap.c