mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
rmap: support file thp
Naive approach: on mapping/unmapping the page as compound we update ->_mapcount on each 4k page. That's not efficient, but it's not obvious how we can optimize this. We can look into optimization later. PG_double_map optimization doesn't work for file pages since lifecycle of file pages is different comparing to anon pages: file page can be mapped again at any time. Link: http://lkml.kernel.org/r/1466021202-61880-11-git-send-email-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
7267ec008b
commit
dd78fedde4
6 changed files with 52 additions and 20 deletions
|
@ -412,6 +412,12 @@ int __page_mapcount(struct page *page)
|
|||
int ret;
|
||||
|
||||
ret = atomic_read(&page->_mapcount) + 1;
|
||||
/*
|
||||
* For file THP page->_mapcount contains total number of mapping
|
||||
* of the page: no need to look into compound_mapcount.
|
||||
*/
|
||||
if (!PageAnon(page) && !PageHuge(page))
|
||||
return ret;
|
||||
page = compound_head(page);
|
||||
ret += atomic_read(compound_mapcount_ptr(page)) + 1;
|
||||
if (PageDoubleMap(page))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue