diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2021-01-23 18:42:25 -0500 |
---|---|---|
committer | Andrea Arcangeli <aarcange@redhat.com> | 2023-11-11 22:03:37 -0500 |
commit | f0003cd2ba0252a1236c86dce24239d0d74c1956 (patch) | |
tree | 7134854b6eb6a82237efe4a702ac4e3273c589f3 | |
parent | d54319eaf2ede87b1d39d4fc9a54ccc380b7e02b (diff) | |
download | aa-f0003cd2ba0252a1236c86dce24239d0d74c1956.tar.gz |
mm: thp: optimize total_mapcount() with head_compound_mapcount
total_mapcount doesn't allow tail pages so head_compound_mapcount can
be used instead of compound_mapcount and it's faster.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
-rw-r--r-- | mm/huge_memory.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a795621d30b9f5..89b0ef0352f16f 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2542,13 +2542,13 @@ int total_mapcount(struct page *page) return atomic_read(&page->_mapcount) + 1; if (PageHuge(page)) - return compound_mapcount(page); + return head_compound_mapcount(page); nr = compound_nr(page); again: seqcount = page_mapcount_seq_begin(page); - compound = ret = compound_mapcount(page); + compound = ret = head_compound_mapcount(page); for (i = 0; i < nr; i++) ret += atomic_read(&page[i]._mapcount) + 1; double_map = PageDoubleMap(page); |