Merge branch 'akpm' (patches from Andrew)
Merge second patch-bomb from Andrew Morton: "Almost all of the rest of MM. There was an unusually large amount of MM material this time" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (141 commits) zpool: remove no-op module init/exit mm: zbud: constify the zbud_ops mm: zpool: constify the zpool_ops mm: swap: zswap: maybe_preload & refactoring zram: unify error reporting zsmalloc: remove null check from destroy_handle_cache() zsmalloc: do not take class lock in zs_shrinker_count() zsmalloc: use class->pages_per_zspage zsmalloc: consider ZS_ALMOST_FULL as migrate source zsmalloc: partial page ordering within a fullness_list zsmalloc: use shrinker to trigger auto-compaction zsmalloc: account the number of compacted pages zsmalloc/zram: introduce zs_pool_stats api zsmalloc: cosmetic compaction code adjustments zsmalloc: introduce zs_can_compact() function zsmalloc: always keep per-class stats zsmalloc: drop unused variable `nr_to_migrate' mm/memblock.c: fix comment in __next_mem_range() mm/page_alloc.c: fix type information of memoryless node memory-hotplug: fix comments in zone_spanned_pages_in_node() and zone_spanned_pages_in_node() ...
This commit is contained in:
@@ -125,6 +125,24 @@ unsigned long dirty_balance_reserve __read_mostly;
|
||||
int percpu_pagelist_fraction;
|
||||
gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
|
||||
|
||||
/*
|
||||
* A cached value of the page's pageblock's migratetype, used when the page is
|
||||
* put on a pcplist. Used to avoid the pageblock migratetype lookup when
|
||||
* freeing from pcplists in most cases, at the cost of possibly becoming stale.
|
||||
* Also the migratetype set in the page does not necessarily match the pcplist
|
||||
* index, e.g. page might have MIGRATE_CMA set but be on a pcplist with any
|
||||
* other index - this ensures that it will be put on the correct CMA freelist.
|
||||
*/
|
||||
static inline int get_pcppage_migratetype(struct page *page)
|
||||
{
|
||||
return page->index;
|
||||
}
|
||||
|
||||
static inline void set_pcppage_migratetype(struct page *page, int migratetype)
|
||||
{
|
||||
page->index = migratetype;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
/*
|
||||
* The following functions are used by the suspend/hibernate code to temporarily
|
||||
@@ -791,7 +809,11 @@ static void free_pcppages_bulk(struct zone *zone, int count,
|
||||
page = list_entry(list->prev, struct page, lru);
|
||||
/* must delete as __free_one_page list manipulates */
|
||||
list_del(&page->lru);
|
||||
mt = get_freepage_migratetype(page);
|
||||
|
||||
mt = get_pcppage_migratetype(page);
|
||||
/* MIGRATE_ISOLATE page should not go to pcplists */
|
||||
VM_BUG_ON_PAGE(is_migrate_isolate(mt), page);
|
||||
/* Pageblock could have been isolated meanwhile */
|
||||
if (unlikely(has_isolate_pageblock(zone)))
|
||||
mt = get_pageblock_migratetype(page);
|
||||
|
||||
@@ -955,7 +977,6 @@ static void __free_pages_ok(struct page *page, unsigned int order)
|
||||
migratetype = get_pfnblock_migratetype(page, pfn);
|
||||
local_irq_save(flags);
|
||||
__count_vm_events(PGFREE, 1 << order);
|
||||
set_freepage_migratetype(page, migratetype);
|
||||
free_one_page(page_zone(page), page, pfn, order, migratetype);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
@@ -1383,7 +1404,7 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
|
||||
rmv_page_order(page);
|
||||
area->nr_free--;
|
||||
expand(zone, page, order, current_order, area, migratetype);
|
||||
set_freepage_migratetype(page, migratetype);
|
||||
set_pcppage_migratetype(page, migratetype);
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -1460,7 +1481,6 @@ int move_freepages(struct zone *zone,
|
||||
order = page_order(page);
|
||||
list_move(&page->lru,
|
||||
&zone->free_area[order].free_list[migratetype]);
|
||||
set_freepage_migratetype(page, migratetype);
|
||||
page += 1 << order;
|
||||
pages_moved += 1 << order;
|
||||
}
|
||||
@@ -1630,14 +1650,13 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype)
|
||||
expand(zone, page, order, current_order, area,
|
||||
start_migratetype);
|
||||
/*
|
||||
* The freepage_migratetype may differ from pageblock's
|
||||
* The pcppage_migratetype may differ from pageblock's
|
||||
* migratetype depending on the decisions in
|
||||
* try_to_steal_freepages(). This is OK as long as it
|
||||
* does not differ for MIGRATE_CMA pageblocks. For CMA
|
||||
* we need to make sure unallocated pages flushed from
|
||||
* pcp lists are returned to the correct freelist.
|
||||
* find_suitable_fallback(). This is OK as long as it does not
|
||||
* differ for MIGRATE_CMA pageblocks. Those can be used as
|
||||
* fallback only via special __rmqueue_cma_fallback() function
|
||||
*/
|
||||
set_freepage_migratetype(page, start_migratetype);
|
||||
set_pcppage_migratetype(page, start_migratetype);
|
||||
|
||||
trace_mm_page_alloc_extfrag(page, order, current_order,
|
||||
start_migratetype, fallback_mt);
|
||||
@@ -1713,7 +1732,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
|
||||
else
|
||||
list_add_tail(&page->lru, list);
|
||||
list = &page->lru;
|
||||
if (is_migrate_cma(get_freepage_migratetype(page)))
|
||||
if (is_migrate_cma(get_pcppage_migratetype(page)))
|
||||
__mod_zone_page_state(zone, NR_FREE_CMA_PAGES,
|
||||
-(1 << order));
|
||||
}
|
||||
@@ -1910,7 +1929,7 @@ void free_hot_cold_page(struct page *page, bool cold)
|
||||
return;
|
||||
|
||||
migratetype = get_pfnblock_migratetype(page, pfn);
|
||||
set_freepage_migratetype(page, migratetype);
|
||||
set_pcppage_migratetype(page, migratetype);
|
||||
local_irq_save(flags);
|
||||
__count_vm_event(PGFREE);
|
||||
|
||||
@@ -2115,7 +2134,7 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
|
||||
if (!page)
|
||||
goto failed;
|
||||
__mod_zone_freepage_state(zone, -(1 << order),
|
||||
get_freepage_migratetype(page));
|
||||
get_pcppage_migratetype(page));
|
||||
}
|
||||
|
||||
__mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order));
|
||||
@@ -2696,6 +2715,12 @@ static inline struct page *
|
||||
__alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
const struct alloc_context *ac, unsigned long *did_some_progress)
|
||||
{
|
||||
struct oom_control oc = {
|
||||
.zonelist = ac->zonelist,
|
||||
.nodemask = ac->nodemask,
|
||||
.gfp_mask = gfp_mask,
|
||||
.order = order,
|
||||
};
|
||||
struct page *page;
|
||||
|
||||
*did_some_progress = 0;
|
||||
@@ -2747,8 +2772,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
goto out;
|
||||
}
|
||||
/* Exhausted what can be done so it's blamo time */
|
||||
if (out_of_memory(ac->zonelist, gfp_mask, order, ac->nodemask, false)
|
||||
|| WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL))
|
||||
if (out_of_memory(&oc) || WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL))
|
||||
*did_some_progress = 1;
|
||||
out:
|
||||
mutex_unlock(&oom_lock);
|
||||
@@ -3490,8 +3514,6 @@ EXPORT_SYMBOL(alloc_pages_exact);
|
||||
*
|
||||
* Like alloc_pages_exact(), but try to allocate on node nid first before falling
|
||||
* back.
|
||||
* Note this is not alloc_pages_exact_node() which allocates on a specific node,
|
||||
* but is not exact.
|
||||
*/
|
||||
void * __meminit alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask)
|
||||
{
|
||||
@@ -5066,7 +5088,7 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid,
|
||||
{
|
||||
unsigned long zone_start_pfn, zone_end_pfn;
|
||||
|
||||
/* When hotadd a new node, the node should be empty */
|
||||
/* When hotadd a new node from cpu_up(), the node should be empty */
|
||||
if (!node_start_pfn && !node_end_pfn)
|
||||
return 0;
|
||||
|
||||
@@ -5133,7 +5155,7 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid,
|
||||
unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type];
|
||||
unsigned long zone_start_pfn, zone_end_pfn;
|
||||
|
||||
/* When hotadd a new node, the node should be empty */
|
||||
/* When hotadd a new node from cpu_up(), the node should be empty */
|
||||
if (!node_start_pfn && !node_end_pfn)
|
||||
return 0;
|
||||
|
||||
@@ -5306,8 +5328,7 @@ static unsigned long __paginginit calc_memmap_size(unsigned long spanned_pages,
|
||||
*
|
||||
* NOTE: pgdat should get zeroed by caller.
|
||||
*/
|
||||
static void __paginginit free_area_init_core(struct pglist_data *pgdat,
|
||||
unsigned long node_start_pfn, unsigned long node_end_pfn)
|
||||
static void __paginginit free_area_init_core(struct pglist_data *pgdat)
|
||||
{
|
||||
enum zone_type j;
|
||||
int nid = pgdat->node_id;
|
||||
@@ -5458,7 +5479,8 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
|
||||
get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
|
||||
pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
|
||||
(u64)start_pfn << PAGE_SHIFT, ((u64)end_pfn << PAGE_SHIFT) - 1);
|
||||
(u64)start_pfn << PAGE_SHIFT,
|
||||
end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0);
|
||||
#endif
|
||||
calculate_node_totalpages(pgdat, start_pfn, end_pfn,
|
||||
zones_size, zholes_size);
|
||||
@@ -5470,7 +5492,7 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
|
||||
(unsigned long)pgdat->node_mem_map);
|
||||
#endif
|
||||
|
||||
free_area_init_core(pgdat, start_pfn, end_pfn);
|
||||
free_area_init_core(pgdat);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
|
||||
@@ -5481,11 +5503,9 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,
|
||||
*/
|
||||
void __init setup_nr_node_ids(void)
|
||||
{
|
||||
unsigned int node;
|
||||
unsigned int highest = 0;
|
||||
unsigned int highest;
|
||||
|
||||
for_each_node_mask(node, node_possible_map)
|
||||
highest = node;
|
||||
highest = find_last_bit(node_possible_map.bits, MAX_NUMNODES);
|
||||
nr_node_ids = highest + 1;
|
||||
}
|
||||
#endif
|
||||
@@ -6006,7 +6026,7 @@ void __init mem_init_print_info(const char *str)
|
||||
* set_dma_reserve - set the specified number of pages reserved in the first zone
|
||||
* @new_dma_reserve: The number of pages to mark reserved
|
||||
*
|
||||
* The per-cpu batchsize and zone watermarks are determined by present_pages.
|
||||
* The per-cpu batchsize and zone watermarks are determined by managed_pages.
|
||||
* In the DMA zone, a significant percentage may be consumed by kernel image
|
||||
* and other unfreeable allocations which can skew the watermarks badly. This
|
||||
* function may optionally be used to account for unfreeable pages in the
|
||||
@@ -6059,7 +6079,7 @@ void __init page_alloc_init(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* calculate_totalreserve_pages - called when sysctl_lower_zone_reserve_ratio
|
||||
* calculate_totalreserve_pages - called when sysctl_lowmem_reserve_ratio
|
||||
* or min_free_kbytes changes.
|
||||
*/
|
||||
static void calculate_totalreserve_pages(void)
|
||||
@@ -6103,7 +6123,7 @@ static void calculate_totalreserve_pages(void)
|
||||
|
||||
/*
|
||||
* setup_per_zone_lowmem_reserve - called whenever
|
||||
* sysctl_lower_zone_reserve_ratio changes. Ensures that each zone
|
||||
* sysctl_lowmem_reserve_ratio changes. Ensures that each zone
|
||||
* has a correct pages reserved value, so an adequate number of
|
||||
* pages are left in the zone after a successful __alloc_pages().
|
||||
*/
|
||||
|
Reference in New Issue
Block a user