提交 a1ca2d9d 编写于 作者: M Miaohe Lin 提交者: Zheng Zengkai

mm/rmap: use page_not_mapped in try_to_unmap()

stable inclusion
from stable-5.10.47
commit bfd90b56d7f6cb225d6c31d2620cecc1a75d6142
bugzilla: 172973 https://gitee.com/openeuler/kernel/issues/I4DAKB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=bfd90b56d7f6cb225d6c31d2620cecc1a75d6142

--------------------------------

[ Upstream commit b7e188ec ]

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.comSigned-off-by: NMiaohe Lin <linmiaohe@huawei.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 c5f8d7a6
......@@ -1722,9 +1722,9 @@ static bool invalid_migration_vma(struct vm_area_struct *vma, void *arg)
return vma_is_temporary_stack(vma);
}
static int page_mapcount_is_zero(struct page *page)
static int page_not_mapped(struct page *page)
{
return !total_mapcount(page);
return !page_mapped(page);
}
/**
......@@ -1742,7 +1742,7 @@ bool try_to_unmap(struct page *page, enum ttu_flags flags)
struct rmap_walk_control rwc = {
.rmap_one = try_to_unmap_one,
.arg = (void *)flags,
.done = page_mapcount_is_zero,
.done = page_not_mapped,
.anon_lock = page_lock_anon_vma_read,
};
......@@ -1766,11 +1766,6 @@ bool try_to_unmap(struct page *page, enum ttu_flags flags)
return !page_mapcount(page) ? true : false;
}
static int page_not_mapped(struct page *page)
{
return !page_mapped(page);
}
/**
* try_to_munlock - try to munlock a page
* @page: the page to be munlocked
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册