Skip to contentSkip to conversation

mm: uninline page_mapped()

PATCH New [email protected] 1 participant 1 message May 20, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 62/117 mm: uninline page_mapped()

From: Andrew Morton <[email protected]>
Subject: mm: uninline page_mapped()

It's huge. Uninlining it saves 206 bytes per callsite. Shaves 4924 bytes from the x86_64 allmodconfig vmlinux.

[[email protected]: coding-style fixes]
Cc Steve Capper <[email protected]>
Cc Kirill A. Shutemov <[email protected]>

---

 include/linux/mm.h |   21 +--------------------
 mm/util.c          |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 20 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-uninline-page_mapped +1 -20
diff -puN include/linux/mm.h~mm-uninline-page_mapped include/linux/mm.h
@@ -1032,26 +1032,7 @@ static inline pgoff_t page_file_index(st
 	return page->index;
 }
 
-/*
- * Return true if this page is mapped into pagetables.
- * For compound page it returns true if any subpage of compound page is mapped.
- */
-static inline bool page_mapped(struct page *page)
-{
-	int i;
-	if (likely(!PageCompound(page)))
-		return atomic_read(&page->_mapcount) >= 0;
-	page = compound_head(page);
-	if (atomic_read(compound_mapcount_ptr(page)) >= 0)
-		return true;
-	if (PageHuge(page))
-		return false;
-	for (i = 0; i < hpage_nr_pages(page); i++) {
-		if (atomic_read(&page[i]._mapcount) >= 0)
-			return true;
-	}
-	return false;
-}
+bool page_mapped(struct page *page);
 
 /*
  * Return true only if the page has been allocated with
mm/util.c renamed from mm/util.c~mm-uninline-page_mapped +23 -0
diff -puN mm/util.c~mm-uninline-page_mapped mm/util.c
@@ -346,6 +346,29 @@ void *page_rmapping(struct page *page)
 	return __page_rmapping(page);
 }
 
+/*
+ * Return true if this page is mapped into pagetables.
+ * For compound page it returns true if any subpage of compound page is mapped.
+ */
+bool page_mapped(struct page *page)
+{
+	int i;
+
+	if (likely(!PageCompound(page)))
+		return atomic_read(&page->_mapcount) >= 0;
+	page = compound_head(page);
+	if (atomic_read(compound_mapcount_ptr(page)) >= 0)
+		return true;
+	if (PageHuge(page))
+		return false;
+	for (i = 0; i < hpage_nr_pages(page); i++) {
+		if (atomic_read(&page[i]._mapcount) >= 0)
+			return true;
+	}
+	return false;
+}
+EXPORT_SYMBOL(page_mapped);
+
 struct anon_vma *page_anon_vma(struct page *page)
 {
 	unsigned long mapping;

_