diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2016-07-26 18:25:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-26 19:19:19 -0400 |
commit | dd78fedde4b99b322f2dc849d467d365a82e23ca (patch) | |
tree | 5095c6e9fd2527a8636188059e35f7f45b9648a2 /mm/util.c | |
parent | 7267ec008b5cd8b3579e188b1ff238815643e372 (diff) |
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>
Diffstat (limited to 'mm/util.c')
-rw-r--r-- | mm/util.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -412,6 +412,12 @@ int __page_mapcount(struct page *page) | |||
412 | int ret; | 412 | int ret; |
413 | 413 | ||
414 | ret = atomic_read(&page->_mapcount) + 1; | 414 | ret = atomic_read(&page->_mapcount) + 1; |
415 | /* | ||
416 | * For file THP page->_mapcount contains total number of mapping | ||
417 | * of the page: no need to look into compound_mapcount. | ||
418 | */ | ||
419 | if (!PageAnon(page) && !PageHuge(page)) | ||
420 | return ret; | ||
415 | page = compound_head(page); | 421 | page = compound_head(page); |
416 | ret += atomic_read(compound_mapcount_ptr(page)) + 1; | 422 | ret += atomic_read(compound_mapcount_ptr(page)) + 1; |
417 | if (PageDoubleMap(page)) | 423 | if (PageDoubleMap(page)) |