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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Feb 2021 17:41:01 +0000 (09:41 -0800)
commitb7e188ec98b1644ff70a6d3624ea16aadc39f5e0
tree9748f1bbea91d5de3e7bfd83c3788e9dcca786f5
parent90aaca852ca13a6c962b25964fb6678120f266b1
mm/rmap: use page_not_mapped in try_to_unmap()

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>
mm/rmap.c