diff options
author | Dave Airlie <airlied@redhat.com> | 2015-08-17 00:13:53 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-08-17 00:13:53 -0400 |
commit | 4eebf60b7452fbd551fd7dece855ba7825a49cbc (patch) | |
tree | 490b4d194ba09c90e10201ab7fc084a0bda0ed27 /mm | |
parent | 8f9cb50789e76f3e224e8861adf650e55c747af4 (diff) | |
parent | 2c6625cd545bdd66acff14f3394865d43920a5c7 (diff) |
Merge tag 'v4.2-rc7' into drm-next
Linux 4.2-rc7
Backmerge master for i915 fixes
Diffstat (limited to 'mm')
-rw-r--r-- | mm/cma.h | 2 | ||||
-rw-r--r-- | mm/huge_memory.c | 7 | ||||
-rw-r--r-- | mm/kasan/kasan.c | 2 | ||||
-rw-r--r-- | mm/kasan/report.c | 2 | ||||
-rw-r--r-- | mm/memory-failure.c | 54 | ||||
-rw-r--r-- | mm/memory_hotplug.c | 13 | ||||
-rw-r--r-- | mm/migrate.c | 8 | ||||
-rw-r--r-- | mm/page-writeback.c | 4 | ||||
-rw-r--r-- | mm/page_alloc.c | 53 | ||||
-rw-r--r-- | mm/shmem.c | 4 | ||||
-rw-r--r-- | mm/slab_common.c | 3 | ||||
-rw-r--r-- | mm/vmscan.c | 16 |
12 files changed, 102 insertions, 66 deletions
@@ -16,7 +16,7 @@ struct cma { | |||
16 | extern struct cma cma_areas[MAX_CMA_AREAS]; | 16 | extern struct cma cma_areas[MAX_CMA_AREAS]; |
17 | extern unsigned cma_area_count; | 17 | extern unsigned cma_area_count; |
18 | 18 | ||
19 | static unsigned long cma_bitmap_maxno(struct cma *cma) | 19 | static inline unsigned long cma_bitmap_maxno(struct cma *cma) |
20 | { | 20 | { |
21 | return cma->count >> cma->order_per_bit; | 21 | return cma->count >> cma->order_per_bit; |
22 | } | 22 | } |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c107094f79ba..097c7a4bfbd9 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1676,12 +1676,7 @@ static void __split_huge_page_refcount(struct page *page, | |||
1676 | /* after clearing PageTail the gup refcount can be released */ | 1676 | /* after clearing PageTail the gup refcount can be released */ |
1677 | smp_mb__after_atomic(); | 1677 | smp_mb__after_atomic(); |
1678 | 1678 | ||
1679 | /* | 1679 | page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; |
1680 | * retain hwpoison flag of the poisoned tail page: | ||
1681 | * fix for the unsuitable process killed on Guest Machine(KVM) | ||
1682 | * by the memory-failure. | ||
1683 | */ | ||
1684 | page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP | __PG_HWPOISON; | ||
1685 | page_tail->flags |= (page->flags & | 1680 | page_tail->flags |= (page->flags & |
1686 | ((1L << PG_referenced) | | 1681 | ((1L << PG_referenced) | |
1687 | (1L << PG_swapbacked) | | 1682 | (1L << PG_swapbacked) | |
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 6c513a63ea84..7b28e9cdf1c7 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * This file contains shadow memory manipulation code. | 2 | * This file contains shadow memory manipulation code. |
3 | * | 3 | * |
4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. | 4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. |
5 | * Author: Andrey Ryabinin <a.ryabinin@samsung.com> | 5 | * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> |
6 | * | 6 | * |
7 | * Some of code borrowed from https://github.com/xairy/linux by | 7 | * Some of code borrowed from https://github.com/xairy/linux by |
8 | * Andrey Konovalov <adech.fo@gmail.com> | 8 | * Andrey Konovalov <adech.fo@gmail.com> |
diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 680ceedf810a..e07c94fbd0ac 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * This file contains error reporting code. | 2 | * This file contains error reporting code. |
3 | * | 3 | * |
4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. | 4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. |
5 | * Author: Andrey Ryabinin <a.ryabinin@samsung.com> | 5 | * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> |
6 | * | 6 | * |
7 | * Some of code borrowed from https://github.com/xairy/linux by | 7 | * Some of code borrowed from https://github.com/xairy/linux by |
8 | * Andrey Konovalov <adech.fo@gmail.com> | 8 | * Andrey Konovalov <adech.fo@gmail.com> |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index c53543d89282..1f4446a90cef 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -909,6 +909,18 @@ int get_hwpoison_page(struct page *page) | |||
909 | * directly for tail pages. | 909 | * directly for tail pages. |
910 | */ | 910 | */ |
911 | if (PageTransHuge(head)) { | 911 | if (PageTransHuge(head)) { |
912 | /* | ||
913 | * Non anonymous thp exists only in allocation/free time. We | ||
914 | * can't handle such a case correctly, so let's give it up. | ||
915 | * This should be better than triggering BUG_ON when kernel | ||
916 | * tries to touch the "partially handled" page. | ||
917 | */ | ||
918 | if (!PageAnon(head)) { | ||
919 | pr_err("MCE: %#lx: non anonymous thp\n", | ||
920 | page_to_pfn(page)); | ||
921 | return 0; | ||
922 | } | ||
923 | |||
912 | if (get_page_unless_zero(head)) { | 924 | if (get_page_unless_zero(head)) { |
913 | if (PageTail(page)) | 925 | if (PageTail(page)) |
914 | get_page(page); | 926 | get_page(page); |
@@ -1134,17 +1146,11 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
1134 | } | 1146 | } |
1135 | 1147 | ||
1136 | if (!PageHuge(p) && PageTransHuge(hpage)) { | 1148 | if (!PageHuge(p) && PageTransHuge(hpage)) { |
1137 | if (!PageAnon(hpage)) { | 1149 | if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) { |
1138 | pr_err("MCE: %#lx: non anonymous thp\n", pfn); | 1150 | if (!PageAnon(hpage)) |
1139 | if (TestClearPageHWPoison(p)) | 1151 | pr_err("MCE: %#lx: non anonymous thp\n", pfn); |
1140 | atomic_long_sub(nr_pages, &num_poisoned_pages); | 1152 | else |
1141 | put_page(p); | 1153 | pr_err("MCE: %#lx: thp split failed\n", pfn); |
1142 | if (p != hpage) | ||
1143 | put_page(hpage); | ||
1144 | return -EBUSY; | ||
1145 | } | ||
1146 | if (unlikely(split_huge_page(hpage))) { | ||
1147 | pr_err("MCE: %#lx: thp split failed\n", pfn); | ||
1148 | if (TestClearPageHWPoison(p)) | 1154 | if (TestClearPageHWPoison(p)) |
1149 | atomic_long_sub(nr_pages, &num_poisoned_pages); | 1155 | atomic_long_sub(nr_pages, &num_poisoned_pages); |
1150 | put_page(p); | 1156 | put_page(p); |
@@ -1209,9 +1215,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
1209 | if (!PageHWPoison(p)) { | 1215 | if (!PageHWPoison(p)) { |
1210 | printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); | 1216 | printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); |
1211 | atomic_long_sub(nr_pages, &num_poisoned_pages); | 1217 | atomic_long_sub(nr_pages, &num_poisoned_pages); |
1218 | unlock_page(hpage); | ||
1212 | put_page(hpage); | 1219 | put_page(hpage); |
1213 | res = 0; | 1220 | return 0; |
1214 | goto out; | ||
1215 | } | 1221 | } |
1216 | if (hwpoison_filter(p)) { | 1222 | if (hwpoison_filter(p)) { |
1217 | if (TestClearPageHWPoison(p)) | 1223 | if (TestClearPageHWPoison(p)) |
@@ -1535,6 +1541,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) | |||
1535 | */ | 1541 | */ |
1536 | ret = __get_any_page(page, pfn, 0); | 1542 | ret = __get_any_page(page, pfn, 0); |
1537 | if (!PageLRU(page)) { | 1543 | if (!PageLRU(page)) { |
1544 | /* Drop page reference which is from __get_any_page() */ | ||
1545 | put_page(page); | ||
1538 | pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n", | 1546 | pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n", |
1539 | pfn, page->flags); | 1547 | pfn, page->flags); |
1540 | return -EIO; | 1548 | return -EIO; |
@@ -1564,13 +1572,12 @@ static int soft_offline_huge_page(struct page *page, int flags) | |||
1564 | unlock_page(hpage); | 1572 | unlock_page(hpage); |
1565 | 1573 | ||
1566 | ret = isolate_huge_page(hpage, &pagelist); | 1574 | ret = isolate_huge_page(hpage, &pagelist); |
1567 | if (ret) { | 1575 | /* |
1568 | /* | 1576 | * get_any_page() and isolate_huge_page() takes a refcount each, |
1569 | * get_any_page() and isolate_huge_page() takes a refcount each, | 1577 | * so need to drop one here. |
1570 | * so need to drop one here. | 1578 | */ |
1571 | */ | 1579 | put_page(hpage); |
1572 | put_page(hpage); | 1580 | if (!ret) { |
1573 | } else { | ||
1574 | pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn); | 1581 | pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn); |
1575 | return -EBUSY; | 1582 | return -EBUSY; |
1576 | } | 1583 | } |
@@ -1656,6 +1663,8 @@ static int __soft_offline_page(struct page *page, int flags) | |||
1656 | inc_zone_page_state(page, NR_ISOLATED_ANON + | 1663 | inc_zone_page_state(page, NR_ISOLATED_ANON + |
1657 | page_is_file_cache(page)); | 1664 | page_is_file_cache(page)); |
1658 | list_add(&page->lru, &pagelist); | 1665 | list_add(&page->lru, &pagelist); |
1666 | if (!TestSetPageHWPoison(page)) | ||
1667 | atomic_long_inc(&num_poisoned_pages); | ||
1659 | ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, | 1668 | ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, |
1660 | MIGRATE_SYNC, MR_MEMORY_FAILURE); | 1669 | MIGRATE_SYNC, MR_MEMORY_FAILURE); |
1661 | if (ret) { | 1670 | if (ret) { |
@@ -1670,9 +1679,8 @@ static int __soft_offline_page(struct page *page, int flags) | |||
1670 | pfn, ret, page->flags); | 1679 | pfn, ret, page->flags); |
1671 | if (ret > 0) | 1680 | if (ret > 0) |
1672 | ret = -EIO; | 1681 | ret = -EIO; |
1673 | } else { | 1682 | if (TestClearPageHWPoison(page)) |
1674 | SetPageHWPoison(page); | 1683 | atomic_long_dec(&num_poisoned_pages); |
1675 | atomic_long_inc(&num_poisoned_pages); | ||
1676 | } | 1684 | } |
1677 | } else { | 1685 | } else { |
1678 | pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n", | 1686 | pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n", |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 26fbba7d888f..6da82bcb0a8b 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -446,7 +446,7 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) | |||
446 | int nr_pages = PAGES_PER_SECTION; | 446 | int nr_pages = PAGES_PER_SECTION; |
447 | int nid = pgdat->node_id; | 447 | int nid = pgdat->node_id; |
448 | int zone_type; | 448 | int zone_type; |
449 | unsigned long flags; | 449 | unsigned long flags, pfn; |
450 | int ret; | 450 | int ret; |
451 | 451 | ||
452 | zone_type = zone - pgdat->node_zones; | 452 | zone_type = zone - pgdat->node_zones; |
@@ -461,6 +461,14 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) | |||
461 | pgdat_resize_unlock(zone->zone_pgdat, &flags); | 461 | pgdat_resize_unlock(zone->zone_pgdat, &flags); |
462 | memmap_init_zone(nr_pages, nid, zone_type, | 462 | memmap_init_zone(nr_pages, nid, zone_type, |
463 | phys_start_pfn, MEMMAP_HOTPLUG); | 463 | phys_start_pfn, MEMMAP_HOTPLUG); |
464 | |||
465 | /* online_page_range is called later and expects pages reserved */ | ||
466 | for (pfn = phys_start_pfn; pfn < phys_start_pfn + nr_pages; pfn++) { | ||
467 | if (!pfn_valid(pfn)) | ||
468 | continue; | ||
469 | |||
470 | SetPageReserved(pfn_to_page(pfn)); | ||
471 | } | ||
464 | return 0; | 472 | return 0; |
465 | } | 473 | } |
466 | 474 | ||
@@ -1269,6 +1277,7 @@ int __ref add_memory(int nid, u64 start, u64 size) | |||
1269 | 1277 | ||
1270 | /* create new memmap entry */ | 1278 | /* create new memmap entry */ |
1271 | firmware_map_add_hotplug(start, start + size, "System RAM"); | 1279 | firmware_map_add_hotplug(start, start + size, "System RAM"); |
1280 | memblock_add_node(start, size, nid); | ||
1272 | 1281 | ||
1273 | goto out; | 1282 | goto out; |
1274 | 1283 | ||
@@ -2005,6 +2014,8 @@ void __ref remove_memory(int nid, u64 start, u64 size) | |||
2005 | 2014 | ||
2006 | /* remove memmap entry */ | 2015 | /* remove memmap entry */ |
2007 | firmware_map_remove(start, start + size, "System RAM"); | 2016 | firmware_map_remove(start, start + size, "System RAM"); |
2017 | memblock_free(start, size); | ||
2018 | memblock_remove(start, size); | ||
2008 | 2019 | ||
2009 | arch_remove_memory(start, size); | 2020 | arch_remove_memory(start, size); |
2010 | 2021 | ||
diff --git a/mm/migrate.c b/mm/migrate.c index ee401e4e5ef1..eb4267107d1f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -880,7 +880,8 @@ static int __unmap_and_move(struct page *page, struct page *newpage, | |||
880 | /* Establish migration ptes or remove ptes */ | 880 | /* Establish migration ptes or remove ptes */ |
881 | if (page_mapped(page)) { | 881 | if (page_mapped(page)) { |
882 | try_to_unmap(page, | 882 | try_to_unmap(page, |
883 | TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS); | 883 | TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS| |
884 | TTU_IGNORE_HWPOISON); | ||
884 | page_was_mapped = 1; | 885 | page_was_mapped = 1; |
885 | } | 886 | } |
886 | 887 | ||
@@ -950,7 +951,10 @@ out: | |||
950 | list_del(&page->lru); | 951 | list_del(&page->lru); |
951 | dec_zone_page_state(page, NR_ISOLATED_ANON + | 952 | dec_zone_page_state(page, NR_ISOLATED_ANON + |
952 | page_is_file_cache(page)); | 953 | page_is_file_cache(page)); |
953 | if (reason != MR_MEMORY_FAILURE) | 954 | /* Soft-offlined page shouldn't go through lru cache list */ |
955 | if (reason == MR_MEMORY_FAILURE) | ||
956 | put_page(page); | ||
957 | else | ||
954 | putback_lru_page(page); | 958 | putback_lru_page(page); |
955 | } | 959 | } |
956 | 960 | ||
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 22cddd3e5de8..5cccc127ef81 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -2063,10 +2063,10 @@ static struct notifier_block ratelimit_nb = { | |||
2063 | */ | 2063 | */ |
2064 | void __init page_writeback_init(void) | 2064 | void __init page_writeback_init(void) |
2065 | { | 2065 | { |
2066 | BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); | ||
2067 | |||
2066 | writeback_set_ratelimit(); | 2068 | writeback_set_ratelimit(); |
2067 | register_cpu_notifier(&ratelimit_nb); | 2069 | register_cpu_notifier(&ratelimit_nb); |
2068 | |||
2069 | BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); | ||
2070 | } | 2070 | } |
2071 | 2071 | ||
2072 | /** | 2072 | /** |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ef19f22b2b7d..df959b7d6085 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/swap.h> | 19 | #include <linux/swap.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/rwsem.h> | ||
22 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
23 | #include <linux/jiffies.h> | 22 | #include <linux/jiffies.h> |
24 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
@@ -981,21 +980,21 @@ static void __init __free_pages_boot_core(struct page *page, | |||
981 | 980 | ||
982 | #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ | 981 | #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ |
983 | defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) | 982 | defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) |
984 | /* Only safe to use early in boot when initialisation is single-threaded */ | 983 | |
985 | static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata; | 984 | static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata; |
986 | 985 | ||
987 | int __meminit early_pfn_to_nid(unsigned long pfn) | 986 | int __meminit early_pfn_to_nid(unsigned long pfn) |
988 | { | 987 | { |
988 | static DEFINE_SPINLOCK(early_pfn_lock); | ||
989 | int nid; | 989 | int nid; |
990 | 990 | ||
991 | /* The system will behave unpredictably otherwise */ | 991 | spin_lock(&early_pfn_lock); |
992 | BUG_ON(system_state != SYSTEM_BOOTING); | ||
993 | |||
994 | nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache); | 992 | nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache); |
995 | if (nid >= 0) | 993 | if (nid < 0) |
996 | return nid; | 994 | nid = 0; |
997 | /* just returns 0 */ | 995 | spin_unlock(&early_pfn_lock); |
998 | return 0; | 996 | |
997 | return nid; | ||
999 | } | 998 | } |
1000 | #endif | 999 | #endif |
1001 | 1000 | ||
@@ -1060,7 +1059,15 @@ static void __init deferred_free_range(struct page *page, | |||
1060 | __free_pages_boot_core(page, pfn, 0); | 1059 | __free_pages_boot_core(page, pfn, 0); |
1061 | } | 1060 | } |
1062 | 1061 | ||
1063 | static __initdata DECLARE_RWSEM(pgdat_init_rwsem); | 1062 | /* Completion tracking for deferred_init_memmap() threads */ |
1063 | static atomic_t pgdat_init_n_undone __initdata; | ||
1064 | static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp); | ||
1065 | |||
1066 | static inline void __init pgdat_init_report_one_done(void) | ||
1067 | { | ||
1068 | if (atomic_dec_and_test(&pgdat_init_n_undone)) | ||
1069 | complete(&pgdat_init_all_done_comp); | ||
1070 | } | ||
1064 | 1071 | ||
1065 | /* Initialise remaining memory on a node */ | 1072 | /* Initialise remaining memory on a node */ |
1066 | static int __init deferred_init_memmap(void *data) | 1073 | static int __init deferred_init_memmap(void *data) |
@@ -1077,7 +1084,7 @@ static int __init deferred_init_memmap(void *data) | |||
1077 | const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); | 1084 | const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); |
1078 | 1085 | ||
1079 | if (first_init_pfn == ULONG_MAX) { | 1086 | if (first_init_pfn == ULONG_MAX) { |
1080 | up_read(&pgdat_init_rwsem); | 1087 | pgdat_init_report_one_done(); |
1081 | return 0; | 1088 | return 0; |
1082 | } | 1089 | } |
1083 | 1090 | ||
@@ -1177,7 +1184,8 @@ free_range: | |||
1177 | 1184 | ||
1178 | pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, | 1185 | pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, |
1179 | jiffies_to_msecs(jiffies - start)); | 1186 | jiffies_to_msecs(jiffies - start)); |
1180 | up_read(&pgdat_init_rwsem); | 1187 | |
1188 | pgdat_init_report_one_done(); | ||
1181 | return 0; | 1189 | return 0; |
1182 | } | 1190 | } |
1183 | 1191 | ||
@@ -1185,14 +1193,17 @@ void __init page_alloc_init_late(void) | |||
1185 | { | 1193 | { |
1186 | int nid; | 1194 | int nid; |
1187 | 1195 | ||
1196 | /* There will be num_node_state(N_MEMORY) threads */ | ||
1197 | atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); | ||
1188 | for_each_node_state(nid, N_MEMORY) { | 1198 | for_each_node_state(nid, N_MEMORY) { |
1189 | down_read(&pgdat_init_rwsem); | ||
1190 | kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); | 1199 | kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); |
1191 | } | 1200 | } |
1192 | 1201 | ||
1193 | /* Block until all are initialised */ | 1202 | /* Block until all are initialised */ |
1194 | down_write(&pgdat_init_rwsem); | 1203 | wait_for_completion(&pgdat_init_all_done_comp); |
1195 | up_write(&pgdat_init_rwsem); | 1204 | |
1205 | /* Reinit limits that are based on free pages after the kernel is up */ | ||
1206 | files_maxfiles_init(); | ||
1196 | } | 1207 | } |
1197 | #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ | 1208 | #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ |
1198 | 1209 | ||
@@ -1285,6 +1296,10 @@ static inline int check_new_page(struct page *page) | |||
1285 | bad_reason = "non-NULL mapping"; | 1296 | bad_reason = "non-NULL mapping"; |
1286 | if (unlikely(atomic_read(&page->_count) != 0)) | 1297 | if (unlikely(atomic_read(&page->_count) != 0)) |
1287 | bad_reason = "nonzero _count"; | 1298 | bad_reason = "nonzero _count"; |
1299 | if (unlikely(page->flags & __PG_HWPOISON)) { | ||
1300 | bad_reason = "HWPoisoned (hardware-corrupted)"; | ||
1301 | bad_flags = __PG_HWPOISON; | ||
1302 | } | ||
1288 | if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { | 1303 | if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { |
1289 | bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; | 1304 | bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; |
1290 | bad_flags = PAGE_FLAGS_CHECK_AT_PREP; | 1305 | bad_flags = PAGE_FLAGS_CHECK_AT_PREP; |
@@ -5045,6 +5060,10 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid, | |||
5045 | { | 5060 | { |
5046 | unsigned long zone_start_pfn, zone_end_pfn; | 5061 | unsigned long zone_start_pfn, zone_end_pfn; |
5047 | 5062 | ||
5063 | /* When hotadd a new node, the node should be empty */ | ||
5064 | if (!node_start_pfn && !node_end_pfn) | ||
5065 | return 0; | ||
5066 | |||
5048 | /* Get the start and end of the zone */ | 5067 | /* Get the start and end of the zone */ |
5049 | zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type]; | 5068 | zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type]; |
5050 | zone_end_pfn = arch_zone_highest_possible_pfn[zone_type]; | 5069 | zone_end_pfn = arch_zone_highest_possible_pfn[zone_type]; |
@@ -5108,6 +5127,10 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid, | |||
5108 | unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; | 5127 | unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; |
5109 | unsigned long zone_start_pfn, zone_end_pfn; | 5128 | unsigned long zone_start_pfn, zone_end_pfn; |
5110 | 5129 | ||
5130 | /* When hotadd a new node, the node should be empty */ | ||
5131 | if (!node_start_pfn && !node_end_pfn) | ||
5132 | return 0; | ||
5133 | |||
5111 | zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high); | 5134 | zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high); |
5112 | zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high); | 5135 | zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high); |
5113 | 5136 | ||
diff --git a/mm/shmem.c b/mm/shmem.c index 4caf8ed24d65..dbe0c1e8349c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -3363,8 +3363,8 @@ put_path: | |||
3363 | * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be | 3363 | * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be |
3364 | * kernel internal. There will be NO LSM permission checks against the | 3364 | * kernel internal. There will be NO LSM permission checks against the |
3365 | * underlying inode. So users of this interface must do LSM checks at a | 3365 | * underlying inode. So users of this interface must do LSM checks at a |
3366 | * higher layer. The one user is the big_key implementation. LSM checks | 3366 | * higher layer. The users are the big_key and shm implementations. LSM |
3367 | * are provided at the key level rather than the inode level. | 3367 | * checks are provided at the key or shm level rather than the inode. |
3368 | * @name: name for dentry (to be seen in /proc/<pid>/maps | 3368 | * @name: name for dentry (to be seen in /proc/<pid>/maps |
3369 | * @size: size to be set for the file | 3369 | * @size: size to be set for the file |
3370 | * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size | 3370 | * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size |
diff --git a/mm/slab_common.c b/mm/slab_common.c index 3e5f8f29c286..86831105a09f 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -37,8 +37,7 @@ struct kmem_cache *kmem_cache; | |||
37 | SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \ | 37 | SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \ |
38 | SLAB_FAILSLAB) | 38 | SLAB_FAILSLAB) |
39 | 39 | ||
40 | #define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \ | 40 | #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | SLAB_NOTRACK) |
41 | SLAB_CACHE_DMA | SLAB_NOTRACK) | ||
42 | 41 | ||
43 | /* | 42 | /* |
44 | * Merge control. If this is set then no merging of slab caches will occur. | 43 | * Merge control. If this is set then no merging of slab caches will occur. |
diff --git a/mm/vmscan.c b/mm/vmscan.c index e61445dce04e..8286938c70de 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -973,22 +973,18 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
973 | * caller can stall after page list has been processed. | 973 | * caller can stall after page list has been processed. |
974 | * | 974 | * |
975 | * 2) Global or new memcg reclaim encounters a page that is | 975 | * 2) Global or new memcg reclaim encounters a page that is |
976 | * not marked for immediate reclaim or the caller does not | 976 | * not marked for immediate reclaim, or the caller does not |
977 | * have __GFP_IO. In this case mark the page for immediate | 977 | * have __GFP_FS (or __GFP_IO if it's simply going to swap, |
978 | * not to fs). In this case mark the page for immediate | ||
978 | * reclaim and continue scanning. | 979 | * reclaim and continue scanning. |
979 | * | 980 | * |
980 | * __GFP_IO is checked because a loop driver thread might | 981 | * Require may_enter_fs because we would wait on fs, which |
982 | * may not have submitted IO yet. And the loop driver might | ||
981 | * enter reclaim, and deadlock if it waits on a page for | 983 | * enter reclaim, and deadlock if it waits on a page for |
982 | * which it is needed to do the write (loop masks off | 984 | * which it is needed to do the write (loop masks off |
983 | * __GFP_IO|__GFP_FS for this reason); but more thought | 985 | * __GFP_IO|__GFP_FS for this reason); but more thought |
984 | * would probably show more reasons. | 986 | * would probably show more reasons. |
985 | * | 987 | * |
986 | * Don't require __GFP_FS, since we're not going into the | ||
987 | * FS, just waiting on its writeback completion. Worryingly, | ||
988 | * ext4 gfs2 and xfs allocate pages with | ||
989 | * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so testing | ||
990 | * may_enter_fs here is liable to OOM on them. | ||
991 | * | ||
992 | * 3) Legacy memcg encounters a page that is not already marked | 988 | * 3) Legacy memcg encounters a page that is not already marked |
993 | * PageReclaim. memcg does not have any dirty pages | 989 | * PageReclaim. memcg does not have any dirty pages |
994 | * throttling so we could easily OOM just because too many | 990 | * throttling so we could easily OOM just because too many |
@@ -1005,7 +1001,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
1005 | 1001 | ||
1006 | /* Case 2 above */ | 1002 | /* Case 2 above */ |
1007 | } else if (sane_reclaim(sc) || | 1003 | } else if (sane_reclaim(sc) || |
1008 | !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) { | 1004 | !PageReclaim(page) || !may_enter_fs) { |
1009 | /* | 1005 | /* |
1010 | * This is slightly racy - end_page_writeback() | 1006 | * This is slightly racy - end_page_writeback() |
1011 | * might have just cleared PageReclaim, then | 1007 | * might have just cleared PageReclaim, then |