aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memblock.c2
-rw-r--r--mm/memory_hotplug.c16
-rw-r--r--mm/page_alloc.c2
-rw-r--r--mm/slab.c6
-rw-r--r--mm/slub.c15
-rw-r--r--mm/vmscan.c1
6 files changed, 26 insertions, 16 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 4d9393c7edc9..82aa349d2f7a 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -246,7 +246,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
246 min(new_area_start, memblock.current_limit), 246 min(new_area_start, memblock.current_limit),
247 new_alloc_size, PAGE_SIZE); 247 new_alloc_size, PAGE_SIZE);
248 248
249 new_array = addr ? __va(addr) : 0; 249 new_array = addr ? __va(addr) : NULL;
250 } 250 }
251 if (!addr) { 251 if (!addr) {
252 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n", 252 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n",
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 3ad25f9d1fc1..6a5b90d0cfd7 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -126,9 +126,6 @@ static void register_page_bootmem_info_section(unsigned long start_pfn)
126 struct mem_section *ms; 126 struct mem_section *ms;
127 struct page *page, *memmap; 127 struct page *page, *memmap;
128 128
129 if (!pfn_valid(start_pfn))
130 return;
131
132 section_nr = pfn_to_section_nr(start_pfn); 129 section_nr = pfn_to_section_nr(start_pfn);
133 ms = __nr_to_section(section_nr); 130 ms = __nr_to_section(section_nr);
134 131
@@ -187,9 +184,16 @@ void register_page_bootmem_info_node(struct pglist_data *pgdat)
187 end_pfn = pfn + pgdat->node_spanned_pages; 184 end_pfn = pfn + pgdat->node_spanned_pages;
188 185
189 /* register_section info */ 186 /* register_section info */
190 for (; pfn < end_pfn; pfn += PAGES_PER_SECTION) 187 for (; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
191 register_page_bootmem_info_section(pfn); 188 /*
192 189 * Some platforms can assign the same pfn to multiple nodes - on
190 * node0 as well as nodeN. To avoid registering a pfn against
191 * multiple nodes we check that this pfn does not already
192 * reside in some other node.
193 */
194 if (pfn_valid(pfn) && (pfn_to_nid(pfn) == node))
195 register_page_bootmem_info_section(pfn);
196 }
193} 197}
194#endif /* !CONFIG_SPARSEMEM_VMEMMAP */ 198#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
195 199
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c66fb875104a..c13ea7538891 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -584,7 +584,7 @@ static inline void __free_one_page(struct page *page,
584 combined_idx = buddy_idx & page_idx; 584 combined_idx = buddy_idx & page_idx;
585 higher_page = page + (combined_idx - page_idx); 585 higher_page = page + (combined_idx - page_idx);
586 buddy_idx = __find_buddy_index(combined_idx, order + 1); 586 buddy_idx = __find_buddy_index(combined_idx, order + 1);
587 higher_buddy = page + (buddy_idx - combined_idx); 587 higher_buddy = higher_page + (buddy_idx - combined_idx);
588 if (page_is_buddy(higher_page, higher_buddy, order + 1)) { 588 if (page_is_buddy(higher_page, higher_buddy, order + 1)) {
589 list_add_tail(&page->lru, 589 list_add_tail(&page->lru,
590 &zone->free_area[order].free_list[migratetype]); 590 &zone->free_area[order].free_list[migratetype]);
diff --git a/mm/slab.c b/mm/slab.c
index 811af03a14ef..c6854759bcf1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -983,7 +983,7 @@ static void *__ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac,
983 } 983 }
984 984
985 /* The caller cannot use PFMEMALLOC objects, find another one */ 985 /* The caller cannot use PFMEMALLOC objects, find another one */
986 for (i = 1; i < ac->avail; i++) { 986 for (i = 0; i < ac->avail; i++) {
987 /* If a !PFMEMALLOC object is found, swap them */ 987 /* If a !PFMEMALLOC object is found, swap them */
988 if (!is_obj_pfmemalloc(ac->entry[i])) { 988 if (!is_obj_pfmemalloc(ac->entry[i])) {
989 objp = ac->entry[i]; 989 objp = ac->entry[i];
@@ -1000,7 +1000,7 @@ static void *__ac_get_obj(struct kmem_cache *cachep, struct array_cache *ac,
1000 l3 = cachep->nodelists[numa_mem_id()]; 1000 l3 = cachep->nodelists[numa_mem_id()];
1001 if (!list_empty(&l3->slabs_free) && force_refill) { 1001 if (!list_empty(&l3->slabs_free) && force_refill) {
1002 struct slab *slabp = virt_to_slab(objp); 1002 struct slab *slabp = virt_to_slab(objp);
1003 ClearPageSlabPfmemalloc(virt_to_page(slabp->s_mem)); 1003 ClearPageSlabPfmemalloc(virt_to_head_page(slabp->s_mem));
1004 clear_obj_pfmemalloc(&objp); 1004 clear_obj_pfmemalloc(&objp);
1005 recheck_pfmemalloc_active(cachep, ac); 1005 recheck_pfmemalloc_active(cachep, ac);
1006 return objp; 1006 return objp;
@@ -1032,7 +1032,7 @@ static void *__ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac,
1032{ 1032{
1033 if (unlikely(pfmemalloc_active)) { 1033 if (unlikely(pfmemalloc_active)) {
1034 /* Some pfmemalloc slabs exist, check if this is one */ 1034 /* Some pfmemalloc slabs exist, check if this is one */
1035 struct page *page = virt_to_page(objp); 1035 struct page *page = virt_to_head_page(objp);
1036 if (PageSlabPfmemalloc(page)) 1036 if (PageSlabPfmemalloc(page))
1037 set_obj_pfmemalloc(&objp); 1037 set_obj_pfmemalloc(&objp);
1038 } 1038 }
diff --git a/mm/slub.c b/mm/slub.c
index 8f78e2577031..2fdd96f9e998 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1524,12 +1524,13 @@ static inline void *acquire_slab(struct kmem_cache *s,
1524} 1524}
1525 1525
1526static int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain); 1526static int put_cpu_partial(struct kmem_cache *s, struct page *page, int drain);
1527static inline bool pfmemalloc_match(struct page *page, gfp_t gfpflags);
1527 1528
1528/* 1529/*
1529 * Try to allocate a partial slab from a specific node. 1530 * Try to allocate a partial slab from a specific node.
1530 */ 1531 */
1531static void *get_partial_node(struct kmem_cache *s, 1532static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n,
1532 struct kmem_cache_node *n, struct kmem_cache_cpu *c) 1533 struct kmem_cache_cpu *c, gfp_t flags)
1533{ 1534{
1534 struct page *page, *page2; 1535 struct page *page, *page2;
1535 void *object = NULL; 1536 void *object = NULL;
@@ -1545,9 +1546,13 @@ static void *get_partial_node(struct kmem_cache *s,
1545 1546
1546 spin_lock(&n->list_lock); 1547 spin_lock(&n->list_lock);
1547 list_for_each_entry_safe(page, page2, &n->partial, lru) { 1548 list_for_each_entry_safe(page, page2, &n->partial, lru) {
1548 void *t = acquire_slab(s, n, page, object == NULL); 1549 void *t;
1549 int available; 1550 int available;
1550 1551
1552 if (!pfmemalloc_match(page, flags))
1553 continue;
1554
1555 t = acquire_slab(s, n, page, object == NULL);
1551 if (!t) 1556 if (!t)
1552 break; 1557 break;
1553 1558
@@ -1614,7 +1619,7 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags,
1614 1619
1615 if (n && cpuset_zone_allowed_hardwall(zone, flags) && 1620 if (n && cpuset_zone_allowed_hardwall(zone, flags) &&
1616 n->nr_partial > s->min_partial) { 1621 n->nr_partial > s->min_partial) {
1617 object = get_partial_node(s, n, c); 1622 object = get_partial_node(s, n, c, flags);
1618 if (object) { 1623 if (object) {
1619 /* 1624 /*
1620 * Return the object even if 1625 * Return the object even if
@@ -1643,7 +1648,7 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node,
1643 void *object; 1648 void *object;
1644 int searchnode = (node == NUMA_NO_NODE) ? numa_node_id() : node; 1649 int searchnode = (node == NUMA_NO_NODE) ? numa_node_id() : node;
1645 1650
1646 object = get_partial_node(s, get_node(s, searchnode), c); 1651 object = get_partial_node(s, get_node(s, searchnode), c, flags);
1647 if (object || node != NUMA_NO_NODE) 1652 if (object || node != NUMA_NO_NODE)
1648 return object; 1653 return object;
1649 1654
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 8d01243d9560..99b434b674c0 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3102,6 +3102,7 @@ int kswapd_run(int nid)
3102 /* failure at boot is fatal */ 3102 /* failure at boot is fatal */
3103 BUG_ON(system_state == SYSTEM_BOOTING); 3103 BUG_ON(system_state == SYSTEM_BOOTING);
3104 printk("Failed to start kswapd on node %d\n",nid); 3104 printk("Failed to start kswapd on node %d\n",nid);
3105 pgdat->kswapd = NULL;
3105 ret = -1; 3106 ret = -1;
3106 } 3107 }
3107 return ret; 3108 return ret;