[PATCH 04/11] unpaged: unifdefed PageCompound

From: Hugh Dickins
Date: Thu Nov 17 2005 - 14:33:42 EST


It looks like snd_xxx is not the only nopage to be using PageReserved as
a way of holding a high-order page together: which no longer works, but
is masked by our failure to free from VM_RESERVED areas. We cannot fix
that bug without first substituting another way to hold the high-order
page together, while farming out the 0-order pages from within it.

That's just what PageCompound is designed for, but it's been kept under
CONFIG_HUGETLB_PAGE. Remove the #ifdefs: which saves some space (out-
of-line put_page), doesn't slow down what most needs to be fast (already
using hugetlb), and unifies the way we handle high-order pages.

Signed-off-by: Hugh Dickins <hugh@xxxxxxxxxxx>
---

include/linux/mm.h | 19 -------------------
include/linux/page-flags.h | 4 ----
mm/page_alloc.c | 5 -----
mm/swap.c | 3 ---
4 files changed, 31 deletions(-)

--- unpaged03/include/linux/mm.h 2005-11-17 13:53:20.000000000 +0000
+++ unpaged04/include/linux/mm.h 2005-11-17 15:10:50.000000000 +0000
@@ -311,8 +311,6 @@ struct page {

extern void FASTCALL(__page_cache_release(struct page *));

-#ifdef CONFIG_HUGETLB_PAGE
-
static inline int page_count(struct page *page)
{
if (PageCompound(page))
@@ -329,23 +327,6 @@ static inline void get_page(struct page

void put_page(struct page *page);

-#else /* CONFIG_HUGETLB_PAGE */
-
-#define page_count(p) (atomic_read(&(p)->_count) + 1)
-
-static inline void get_page(struct page *page)
-{
- atomic_inc(&page->_count);
-}
-
-static inline void put_page(struct page *page)
-{
- if (put_page_testzero(page))
- __page_cache_release(page);
-}
-
-#endif /* CONFIG_HUGETLB_PAGE */
-
/*
* Multiple processes may "see" the same page. E.g. for untouched
* mappings of /dev/null, all processes see the same page full of
--- unpaged03/include/linux/page-flags.h 2005-10-28 01:02:08.000000000 +0100
+++ unpaged04/include/linux/page-flags.h 2005-11-17 15:10:50.000000000 +0000
@@ -287,11 +287,7 @@ extern void __mod_page_state(unsigned lo
#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)

-#ifdef CONFIG_HUGETLB_PAGE
#define PageCompound(page) test_bit(PG_compound, &(page)->flags)
-#else
-#define PageCompound(page) 0
-#endif
#define SetPageCompound(page) set_bit(PG_compound, &(page)->flags)
#define ClearPageCompound(page) clear_bit(PG_compound, &(page)->flags)

--- unpaged03/mm/page_alloc.c 2005-11-17 13:53:21.000000000 +0000
+++ unpaged04/mm/page_alloc.c 2005-11-17 15:10:50.000000000 +0000
@@ -148,10 +148,6 @@ static void bad_page(const char *functio
add_taint(TAINT_BAD_PAGE);
}

-#ifndef CONFIG_HUGETLB_PAGE
-#define prep_compound_page(page, order) do { } while (0)
-#define destroy_compound_page(page, order) do { } while (0)
-#else
/*
* Higher-order pages are called "compound pages". They are structured thusly:
*
@@ -205,7 +201,6 @@ static void destroy_compound_page(struct
ClearPageCompound(p);
}
}
-#endif /* CONFIG_HUGETLB_PAGE */

/*
* function for dealing with page's order in buddy system.
--- unpaged03/mm/swap.c 2005-11-12 09:01:25.000000000 +0000
+++ unpaged04/mm/swap.c 2005-11-17 15:10:50.000000000 +0000
@@ -34,8 +34,6 @@
/* How many pages do we try to swap or page in/out together? */
int page_cluster;

-#ifdef CONFIG_HUGETLB_PAGE
-
void put_page(struct page *page)
{
if (unlikely(PageCompound(page))) {
@@ -52,7 +50,6 @@ void put_page(struct page *page)
__page_cache_release(page);
}
EXPORT_SYMBOL(put_page);
-#endif

/*
* Writeback is about to end against a page which has been marked for immediate
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/