Commit 467769ab authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] uninline put_page()

Shrinks my vmlinux by an astonishing 28k.

   text    data     bss     dec     hex filename
3038796  589890  150612 3779298b  39aae2 vmlinux.before
3009761  590107  150612 3750480  393a50 vmlinux.after

Thanks to Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua> for performing
the analysis.
parent 03e95caf
...@@ -255,22 +255,7 @@ static inline void get_page(struct page *page) ...@@ -255,22 +255,7 @@ static inline void get_page(struct page *page)
atomic_inc(&page->count); atomic_inc(&page->count);
} }
static inline void put_page(struct page *page) void put_page(struct page *page);
{
if (unlikely(PageCompound(page))) {
page = (struct page *)page->private;
if (put_page_testzero(page)) {
if (page[1].mapping) { /* destructor? */
(*(void (*)(struct page *))page[1].mapping)(page);
} else {
__page_cache_release(page);
}
}
return;
}
if (!PageReserved(page) && put_page_testzero(page))
__page_cache_release(page);
}
#else /* CONFIG_HUGETLB_PAGE */ #else /* CONFIG_HUGETLB_PAGE */
......
...@@ -34,6 +34,27 @@ ...@@ -34,6 +34,27 @@
/* How many pages do we try to swap or page in/out together? */ /* How many pages do we try to swap or page in/out together? */
int page_cluster; int page_cluster;
#ifdef CONFIG_HUGETLB_PAGE
void put_page(struct page *page)
{
if (unlikely(PageCompound(page))) {
page = (struct page *)page->private;
if (put_page_testzero(page)) {
if (page[1].mapping) { /* destructor? */
(*(void (*)(struct page *))page[1].mapping)(page);
} else {
__page_cache_release(page);
}
}
return;
}
if (!PageReserved(page) && put_page_testzero(page))
__page_cache_release(page);
}
EXPORT_SYMBOL(put_page);
#endif
/* /*
* Writeback is about to end against a page which has been marked for immediate * Writeback is about to end against a page which has been marked for immediate
* reclaim. If it still appears to be reclaimable, move it to the tail of the * reclaim. If it still appears to be reclaimable, move it to the tail of the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment