[PATCH] shrink struct page

Reduce the size of the pageframe for NR_CPUS>4, CONFIG_PREEMPT back to the
minimal size by unionising both ->private and ->mapping with the pagetable
lock.

It uses an anonymous struct and hence requires gcc-3.x.

Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Andrew Morton 2006-01-08 01:04:36 -08:00 committed by Linus Torvalds
parent 59d9136b98
commit 349aef0bc4

View file

@ -223,17 +223,15 @@ struct page {
* & limit reverse map searches. * & limit reverse map searches.
*/ */
union { union {
struct {
unsigned long private; /* Mapping-private opaque data: unsigned long private; /* Mapping-private opaque data:
* usually used for buffer_heads * usually used for buffer_heads
* if PagePrivate set; used for * if PagePrivate set; used for
* swp_entry_t if PageSwapCache * swp_entry_t if PageSwapCache.
* When page is free, this indicates * When page is free, this
* order in the buddy system. * indicates order in the buddy
* system.
*/ */
#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
spinlock_t ptl;
#endif
} u;
struct address_space *mapping; /* If low bit clear, points to struct address_space *mapping; /* If low bit clear, points to
* inode address_space, or NULL. * inode address_space, or NULL.
* If page mapped as anonymous * If page mapped as anonymous
@ -241,6 +239,11 @@ struct page {
* it points to anon_vma object: * it points to anon_vma object:
* see PAGE_MAPPING_ANON below. * see PAGE_MAPPING_ANON below.
*/ */
};
#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
spinlock_t ptl;
#endif
};
pgoff_t index; /* Our offset within mapping. */ pgoff_t index; /* Our offset within mapping. */
struct list_head lru; /* Pageout list, eg. active_list struct list_head lru; /* Pageout list, eg. active_list
* protected by zone->lru_lock ! * protected by zone->lru_lock !
@ -261,8 +264,8 @@ struct page {
#endif /* WANT_PAGE_VIRTUAL */ #endif /* WANT_PAGE_VIRTUAL */
}; };
#define page_private(page) ((page)->u.private) #define page_private(page) ((page)->private)
#define set_page_private(page, v) ((page)->u.private = (v)) #define set_page_private(page, v) ((page)->private = (v))
/* /*
* FIXME: take this include out, include page-flags.h in * FIXME: take this include out, include page-flags.h in
@ -815,7 +818,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
* overflow into the next struct page (as it might with DEBUG_SPINLOCK). * overflow into the next struct page (as it might with DEBUG_SPINLOCK).
* When freeing, reset page->mapping so free_pages_check won't complain. * When freeing, reset page->mapping so free_pages_check won't complain.
*/ */
#define __pte_lockptr(page) &((page)->u.ptl) #define __pte_lockptr(page) &((page)->ptl)
#define pte_lock_init(_page) do { \ #define pte_lock_init(_page) do { \
spin_lock_init(__pte_lockptr(_page)); \ spin_lock_init(__pte_lockptr(_page)); \
} while (0) } while (0)