aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-01-13 18:47:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 20:32:43 -0500
commit5f24ce5fd34c3ca1b3d10d30da754732da64d5c0 (patch)
treec82d27461f2adda210e77808b7dd04eaec017f2f /include
parent21ae5b01750f14140809508a478a4413792e0261 (diff)
thp: remove PG_buddy
PG_buddy can be converted to _mapcount == -2. So the PG_compound_lock can be added to page->flags without overflowing (because of the sparse section bits increasing) with CONFIG_X86_PAE=y and CONFIG_X86_PAT=y. This also has to move the memory hotplug code from _mapcount to lru.next to avoid any risk of clashes. We can't use lru.next for PG_buddy removal, but memory hotplug can use lru.next even more easily than the mapcount instead. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/memory_hotplug.h14
-rw-r--r--include/linux/mm.h21
-rw-r--r--include/linux/page-flags.h7
3 files changed, 31 insertions, 11 deletions
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 31c237a00c48..24376fe7ee68 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -13,12 +13,16 @@ struct mem_section;
13#ifdef CONFIG_MEMORY_HOTPLUG 13#ifdef CONFIG_MEMORY_HOTPLUG
14 14
15/* 15/*
16 * Types for free bootmem. 16 * Types for free bootmem stored in page->lru.next. These have to be in
17 * The normal smallest mapcount is -1. Here is smaller value than it. 17 * some random range in unsigned long space for debugging purposes.
18 */ 18 */
19#define SECTION_INFO (-1 - 1) 19enum {
20#define MIX_SECTION_INFO (-1 - 2) 20 MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 12,
21#define NODE_INFO (-1 - 3) 21 SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE,
22 MIX_SECTION_INFO,
23 NODE_INFO,
24 MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
25};
22 26
23/* 27/*
24 * pgdat resizing functions 28 * pgdat resizing functions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 2ec5138badab..7ab7d2b60041 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -397,6 +397,27 @@ static inline void init_page_count(struct page *page)
397 atomic_set(&page->_count, 1); 397 atomic_set(&page->_count, 1);
398} 398}
399 399
400/*
401 * PageBuddy() indicate that the page is free and in the buddy system
402 * (see mm/page_alloc.c).
403 */
404static inline int PageBuddy(struct page *page)
405{
406 return atomic_read(&page->_mapcount) == -2;
407}
408
409static inline void __SetPageBuddy(struct page *page)
410{
411 VM_BUG_ON(atomic_read(&page->_mapcount) != -1);
412 atomic_set(&page->_mapcount, -2);
413}
414
415static inline void __ClearPageBuddy(struct page *page)
416{
417 VM_BUG_ON(!PageBuddy(page));
418 atomic_set(&page->_mapcount, -1);
419}
420
400void put_page(struct page *page); 421void put_page(struct page *page);
401void put_pages_list(struct list_head *pages); 422void put_pages_list(struct list_head *pages);
402 423
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 4ca1241ef94e..0db8037e2725 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -48,9 +48,6 @@
48 * struct page (these bits with information) are always mapped into kernel 48 * struct page (these bits with information) are always mapped into kernel
49 * address space... 49 * address space...
50 * 50 *
51 * PG_buddy is set to indicate that the page is free and in the buddy system
52 * (see mm/page_alloc.c).
53 *
54 * PG_hwpoison indicates that a page got corrupted in hardware and contains 51 * PG_hwpoison indicates that a page got corrupted in hardware and contains
55 * data with incorrect ECC bits that triggered a machine check. Accessing is 52 * data with incorrect ECC bits that triggered a machine check. Accessing is
56 * not safe since it may cause another machine check. Don't touch! 53 * not safe since it may cause another machine check. Don't touch!
@@ -96,7 +93,6 @@ enum pageflags {
96 PG_swapcache, /* Swap page: swp_entry_t in private */ 93 PG_swapcache, /* Swap page: swp_entry_t in private */
97 PG_mappedtodisk, /* Has blocks allocated on-disk */ 94 PG_mappedtodisk, /* Has blocks allocated on-disk */
98 PG_reclaim, /* To be reclaimed asap */ 95 PG_reclaim, /* To be reclaimed asap */
99 PG_buddy, /* Page is free, on buddy lists */
100 PG_swapbacked, /* Page is backed by RAM/swap */ 96 PG_swapbacked, /* Page is backed by RAM/swap */
101 PG_unevictable, /* Page is "unevictable" */ 97 PG_unevictable, /* Page is "unevictable" */
102#ifdef CONFIG_MMU 98#ifdef CONFIG_MMU
@@ -233,7 +229,6 @@ PAGEFLAG(OwnerPriv1, owner_priv_1) TESTCLEARFLAG(OwnerPriv1, owner_priv_1)
233 * risky: they bypass page accounting. 229 * risky: they bypass page accounting.
234 */ 230 */
235TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback) 231TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback)
236__PAGEFLAG(Buddy, buddy)
237PAGEFLAG(MappedToDisk, mappedtodisk) 232PAGEFLAG(MappedToDisk, mappedtodisk)
238 233
239/* PG_readahead is only used for file reads; PG_reclaim is only for writes */ 234/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
@@ -461,7 +456,7 @@ static inline int PageTransCompound(struct page *page)
461#define PAGE_FLAGS_CHECK_AT_FREE \ 456#define PAGE_FLAGS_CHECK_AT_FREE \
462 (1 << PG_lru | 1 << PG_locked | \ 457 (1 << PG_lru | 1 << PG_locked | \
463 1 << PG_private | 1 << PG_private_2 | \ 458 1 << PG_private | 1 << PG_private_2 | \
464 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 459 1 << PG_writeback | 1 << PG_reserved | \
465 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 460 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
466 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \ 461 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \
467 __PG_COMPOUND_LOCK) 462 __PG_COMPOUND_LOCK)