mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 13:44:26 -04:00
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>
This commit is contained in:
parent
21ae5b0175
commit
5f24ce5fd3
7 changed files with 52 additions and 29 deletions
|
|
@ -13,12 +13,16 @@ struct mem_section;
|
|||
#ifdef CONFIG_MEMORY_HOTPLUG
|
||||
|
||||
/*
|
||||
* Types for free bootmem.
|
||||
* The normal smallest mapcount is -1. Here is smaller value than it.
|
||||
* Types for free bootmem stored in page->lru.next. These have to be in
|
||||
* some random range in unsigned long space for debugging purposes.
|
||||
*/
|
||||
#define SECTION_INFO (-1 - 1)
|
||||
#define MIX_SECTION_INFO (-1 - 2)
|
||||
#define NODE_INFO (-1 - 3)
|
||||
enum {
|
||||
MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 12,
|
||||
SECTION_INFO = MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE,
|
||||
MIX_SECTION_INFO,
|
||||
NODE_INFO,
|
||||
MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = NODE_INFO,
|
||||
};
|
||||
|
||||
/*
|
||||
* pgdat resizing functions
|
||||
|
|
|
|||
|
|
@ -397,6 +397,27 @@ static inline void init_page_count(struct page *page)
|
|||
atomic_set(&page->_count, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* PageBuddy() indicate that the page is free and in the buddy system
|
||||
* (see mm/page_alloc.c).
|
||||
*/
|
||||
static inline int PageBuddy(struct page *page)
|
||||
{
|
||||
return atomic_read(&page->_mapcount) == -2;
|
||||
}
|
||||
|
||||
static inline void __SetPageBuddy(struct page *page)
|
||||
{
|
||||
VM_BUG_ON(atomic_read(&page->_mapcount) != -1);
|
||||
atomic_set(&page->_mapcount, -2);
|
||||
}
|
||||
|
||||
static inline void __ClearPageBuddy(struct page *page)
|
||||
{
|
||||
VM_BUG_ON(!PageBuddy(page));
|
||||
atomic_set(&page->_mapcount, -1);
|
||||
}
|
||||
|
||||
void put_page(struct page *page);
|
||||
void put_pages_list(struct list_head *pages);
|
||||
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@
|
|||
* struct page (these bits with information) are always mapped into kernel
|
||||
* address space...
|
||||
*
|
||||
* PG_buddy is set to indicate that the page is free and in the buddy system
|
||||
* (see mm/page_alloc.c).
|
||||
*
|
||||
* PG_hwpoison indicates that a page got corrupted in hardware and contains
|
||||
* data with incorrect ECC bits that triggered a machine check. Accessing is
|
||||
* not safe since it may cause another machine check. Don't touch!
|
||||
|
|
@ -96,7 +93,6 @@ enum pageflags {
|
|||
PG_swapcache, /* Swap page: swp_entry_t in private */
|
||||
PG_mappedtodisk, /* Has blocks allocated on-disk */
|
||||
PG_reclaim, /* To be reclaimed asap */
|
||||
PG_buddy, /* Page is free, on buddy lists */
|
||||
PG_swapbacked, /* Page is backed by RAM/swap */
|
||||
PG_unevictable, /* Page is "unevictable" */
|
||||
#ifdef CONFIG_MMU
|
||||
|
|
@ -233,7 +229,6 @@ PAGEFLAG(OwnerPriv1, owner_priv_1) TESTCLEARFLAG(OwnerPriv1, owner_priv_1)
|
|||
* risky: they bypass page accounting.
|
||||
*/
|
||||
TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback)
|
||||
__PAGEFLAG(Buddy, buddy)
|
||||
PAGEFLAG(MappedToDisk, mappedtodisk)
|
||||
|
||||
/* 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)
|
|||
#define PAGE_FLAGS_CHECK_AT_FREE \
|
||||
(1 << PG_lru | 1 << PG_locked | \
|
||||
1 << PG_private | 1 << PG_private_2 | \
|
||||
1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
|
||||
1 << PG_writeback | 1 << PG_reserved | \
|
||||
1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
|
||||
1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \
|
||||
__PG_COMPOUND_LOCK)
|
||||
|
|
|
|||
Loading…
Reference in a new issue