diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2016-05-19 20:12:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-19 22:12:14 -0400 |
commit | 1aa8aea535977f0e0b398f39d052e7befff81da6 (patch) | |
tree | b62bccedaf7ff2763dfc3788557482d16eb1cb46 /mm/util.c | |
parent | 29f9cb53d25cd9916537b44b0af7f0b95a2e4438 (diff) |
mm: uninline page_mapped()
It's huge. Uninlining it saves 206 bytes per callsite. Shaves 4924
bytes from the x86_64 allmodconfig vmlinux.
[akpm@linux-foundation.org: coding-style fixes]
Cc: Steve Capper <steve.capper@arm.com>
Cc: 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 | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -346,6 +346,29 @@ void *page_rmapping(struct page *page) | |||
346 | return __page_rmapping(page); | 346 | return __page_rmapping(page); |
347 | } | 347 | } |
348 | 348 | ||
349 | /* | ||
350 | * Return true if this page is mapped into pagetables. | ||
351 | * For compound page it returns true if any subpage of compound page is mapped. | ||
352 | */ | ||
353 | bool page_mapped(struct page *page) | ||
354 | { | ||
355 | int i; | ||
356 | |||
357 | if (likely(!PageCompound(page))) | ||
358 | return atomic_read(&page->_mapcount) >= 0; | ||
359 | page = compound_head(page); | ||
360 | if (atomic_read(compound_mapcount_ptr(page)) >= 0) | ||
361 | return true; | ||
362 | if (PageHuge(page)) | ||
363 | return false; | ||
364 | for (i = 0; i < hpage_nr_pages(page); i++) { | ||
365 | if (atomic_read(&page[i]._mapcount) >= 0) | ||
366 | return true; | ||
367 | } | ||
368 | return false; | ||
369 | } | ||
370 | EXPORT_SYMBOL(page_mapped); | ||
371 | |||
349 | struct anon_vma *page_anon_vma(struct page *page) | 372 | struct anon_vma *page_anon_vma(struct page *page) |
350 | { | 373 | { |
351 | unsigned long mapping; | 374 | unsigned long mapping; |