Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'akpm' (patches from Andrew)

Merge fixes from Andrew Morton:
"21 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (21 commits)
writeback: fix initial dirty limit
mm/memory-failure: set PageHWPoison before migrate_pages()
mm: check __PG_HWPOISON separately from PAGE_FLAGS_CHECK_AT_*
mm/memory-failure: give up error handling for non-tail-refcounted thp
mm/memory-failure: fix race in counting num_poisoned_pages
mm/memory-failure: unlock_page before put_page
ipc: use private shmem or hugetlbfs inodes for shm segments.
mm: initialize hotplugged pages as reserved
ocfs2: fix shift left overflow
kthread: export kthread functions
fsnotify: fix oops in fsnotify_clear_marks_by_group_flags()
lib/iommu-common.c: do not use 0xffffffffffffffffl for computing align_mask
mm/slub: allow merging when SLAB_DEBUG_FREE is set
signalfd: fix information leak in signalfd_copyinfo
signal: fix information leak in copy_siginfo_to_user
signal: fix information leak in copy_siginfo_from_user32
ocfs2: fix BUG in ocfs2_downconvert_thread_do_work()
fs, file table: reinit files_stat.max_files after deferred memory initialisation
mm, meminit: replace rwsem with completion
mm, meminit: allow early_pfn_to_nid to be used during runtime
...

+155 -104
+2 -3
arch/arm64/kernel/signal32.c
··· 168 168 * Other callers might not initialize the si_lsb field, 169 169 * so check explicitely for the right codes here. 170 170 */ 171 - if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) 171 + if (from->si_signo == SIGBUS && 172 + (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) 172 173 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); 173 174 #endif 174 175 break; ··· 202 201 203 202 int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) 204 203 { 205 - memset(to, 0, sizeof *to); 206 - 207 204 if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) || 208 205 copy_from_user(to->_sifields._pad, 209 206 from->_sifields._pad, SI_PAD_SIZE))
-2
arch/mips/kernel/signal32.c
··· 409 409 410 410 int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) 411 411 { 412 - memset(to, 0, sizeof *to); 413 - 414 412 if (copy_from_user(to, from, 3*sizeof(int)) || 415 413 copy_from_user(to->_sifields._pad, 416 414 from->_sifields._pad, SI_PAD_SIZE32))
-2
arch/powerpc/kernel/signal_32.c
··· 966 966 967 967 int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) 968 968 { 969 - memset(to, 0, sizeof *to); 970 - 971 969 if (copy_from_user(to, from, 3*sizeof(int)) || 972 970 copy_from_user(to->_sifields._pad, 973 971 from->_sifields._pad, SI_PAD_SIZE32))
-2
arch/tile/kernel/compat_signal.c
··· 113 113 if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo))) 114 114 return -EFAULT; 115 115 116 - memset(to, 0, sizeof(*to)); 117 - 118 116 err = __get_user(to->si_signo, &from->si_signo); 119 117 err |= __get_user(to->si_errno, &from->si_errno); 120 118 err |= __get_user(to->si_code, &from->si_code);
+3 -10
fs/dcache.c
··· 3442 3442 inode_init_early(); 3443 3443 } 3444 3444 3445 - void __init vfs_caches_init(unsigned long mempages) 3445 + void __init vfs_caches_init(void) 3446 3446 { 3447 - unsigned long reserve; 3448 - 3449 - /* Base hash sizes on available memory, with a reserve equal to 3450 - 150% of current kernel size */ 3451 - 3452 - reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1); 3453 - mempages -= reserve; 3454 - 3455 3447 names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0, 3456 3448 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); 3457 3449 3458 3450 dcache_init(); 3459 3451 inode_init(); 3460 - files_init(mempages); 3452 + files_init(); 3453 + files_maxfiles_init(); 3461 3454 mnt_init(); 3462 3455 bdev_cache_init(); 3463 3456 chrdev_init();
+17 -11
fs/file_table.c
··· 25 25 #include <linux/hardirq.h> 26 26 #include <linux/task_work.h> 27 27 #include <linux/ima.h> 28 + #include <linux/swap.h> 28 29 29 30 #include <linux/atomic.h> 30 31 ··· 309 308 } 310 309 } 311 310 312 - void __init files_init(unsigned long mempages) 311 + void __init files_init(void) 313 312 { 314 - unsigned long n; 315 - 316 313 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, 317 314 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); 318 - 319 - /* 320 - * One file with associated inode and dcache is very roughly 1K. 321 - * Per default don't use more than 10% of our memory for files. 322 - */ 323 - 324 - n = (mempages * (PAGE_SIZE / 1024)) / 10; 325 - files_stat.max_files = max_t(unsigned long, n, NR_FILE); 326 315 percpu_counter_init(&nr_files, 0, GFP_KERNEL); 316 + } 317 + 318 + /* 319 + * One file with associated inode and dcache is very roughly 1K. Per default 320 + * do not use more than 10% of our memory for files. 321 + */ 322 + void __init files_maxfiles_init(void) 323 + { 324 + unsigned long n; 325 + unsigned long memreserve = (totalram_pages - nr_free_pages()) * 3/2; 326 + 327 + memreserve = min(memreserve, totalram_pages - 1); 328 + n = ((totalram_pages - memreserve) * (PAGE_SIZE / 1024)) / 10; 329 + 330 + files_stat.max_files = max_t(unsigned long, n, NR_FILE); 327 331 }
+2
fs/hugetlbfs/inode.c
··· 1010 1010 inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0); 1011 1011 if (!inode) 1012 1012 goto out_dentry; 1013 + if (creat_flags == HUGETLB_SHMFS_INODE) 1014 + inode->i_flags |= S_PRIVATE; 1013 1015 1014 1016 file = ERR_PTR(-ENOMEM); 1015 1017 if (hugetlb_reserve_pages(inode, 0,
+25 -5
fs/notify/mark.c
··· 412 412 unsigned int flags) 413 413 { 414 414 struct fsnotify_mark *lmark, *mark; 415 + LIST_HEAD(to_free); 415 416 417 + /* 418 + * We have to be really careful here. Anytime we drop mark_mutex, e.g. 419 + * fsnotify_clear_marks_by_inode() can come and free marks. Even in our 420 + * to_free list so we have to use mark_mutex even when accessing that 421 + * list. And freeing mark requires us to drop mark_mutex. So we can 422 + * reliably free only the first mark in the list. That's why we first 423 + * move marks to free to to_free list in one go and then free marks in 424 + * to_free list one by one. 425 + */ 416 426 mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); 417 427 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { 418 - if (mark->flags & flags) { 419 - fsnotify_get_mark(mark); 420 - fsnotify_destroy_mark_locked(mark, group); 421 - fsnotify_put_mark(mark); 422 - } 428 + if (mark->flags & flags) 429 + list_move(&mark->g_list, &to_free); 423 430 } 424 431 mutex_unlock(&group->mark_mutex); 432 + 433 + while (1) { 434 + mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); 435 + if (list_empty(&to_free)) { 436 + mutex_unlock(&group->mark_mutex); 437 + break; 438 + } 439 + mark = list_first_entry(&to_free, struct fsnotify_mark, g_list); 440 + fsnotify_get_mark(mark); 441 + fsnotify_destroy_mark_locked(mark, group); 442 + mutex_unlock(&group->mark_mutex); 443 + fsnotify_put_mark(mark); 444 + } 425 445 } 426 446 427 447 /*
+2 -2
fs/ocfs2/aops.c
··· 685 685 686 686 if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) { 687 687 u64 s = i_size_read(inode); 688 - sector_t sector = (p_cpos << (osb->s_clustersize_bits - 9)) + 688 + sector_t sector = ((u64)p_cpos << (osb->s_clustersize_bits - 9)) + 689 689 (do_div(s, osb->s_clustersize) >> 9); 690 690 691 691 ret = blkdev_issue_zeroout(osb->sb->s_bdev, sector, ··· 910 910 BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN)); 911 911 912 912 ret = blkdev_issue_zeroout(osb->sb->s_bdev, 913 - p_cpos << (osb->s_clustersize_bits - 9), 913 + (u64)p_cpos << (osb->s_clustersize_bits - 9), 914 914 zero_len_head >> 9, GFP_NOFS, false); 915 915 if (ret < 0) 916 916 mlog_errno(ret);
+7 -3
fs/ocfs2/dlmglue.c
··· 4025 4025 osb->dc_work_sequence = osb->dc_wake_sequence; 4026 4026 4027 4027 processed = osb->blocked_lock_count; 4028 - while (processed) { 4029 - BUG_ON(list_empty(&osb->blocked_lock_list)); 4030 - 4028 + /* 4029 + * blocked lock processing in this loop might call iput which can 4030 + * remove items off osb->blocked_lock_list. Downconvert up to 4031 + * 'processed' number of locks, but stop short if we had some 4032 + * removed in ocfs2_mark_lockres_freeing when downconverting. 4033 + */ 4034 + while (processed && !list_empty(&osb->blocked_lock_list)) { 4031 4035 lockres = list_entry(osb->blocked_lock_list.next, 4032 4036 struct ocfs2_lock_res, l_blocked_list); 4033 4037 list_del_init(&lockres->l_blocked_list);
+3 -2
fs/signalfd.c
··· 121 121 * Other callers might not initialize the si_lsb field, 122 122 * so check explicitly for the right codes here. 123 123 */ 124 - if (kinfo->si_code == BUS_MCEERR_AR || 125 - kinfo->si_code == BUS_MCEERR_AO) 124 + if (kinfo->si_signo == SIGBUS && 125 + (kinfo->si_code == BUS_MCEERR_AR || 126 + kinfo->si_code == BUS_MCEERR_AO)) 126 127 err |= __put_user((short) kinfo->si_addr_lsb, 127 128 &uinfo->ssi_addr_lsb); 128 129 #endif
+3 -2
include/linux/fs.h
··· 55 55 56 56 extern void __init inode_init(void); 57 57 extern void __init inode_init_early(void); 58 - extern void __init files_init(unsigned long); 58 + extern void __init files_init(void); 59 + extern void __init files_maxfiles_init(void); 59 60 60 61 extern struct files_stat_struct files_stat; 61 62 extern unsigned long get_max_files(void); ··· 2246 2245 2247 2246 /* fs/dcache.c */ 2248 2247 extern void __init vfs_caches_init_early(void); 2249 - extern void __init vfs_caches_init(unsigned long); 2248 + extern void __init vfs_caches_init(void); 2250 2249 2251 2250 extern struct kmem_cache *names_cachep; 2252 2251
+7 -3
include/linux/page-flags.h
··· 631 631 1 << PG_private | 1 << PG_private_2 | \ 632 632 1 << PG_writeback | 1 << PG_reserved | \ 633 633 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 634 - 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \ 634 + 1 << PG_unevictable | __PG_MLOCKED | \ 635 635 __PG_COMPOUND_LOCK) 636 636 637 637 /* 638 638 * Flags checked when a page is prepped for return by the page allocator. 639 - * Pages being prepped should not have any flags set. It they are set, 639 + * Pages being prepped should not have these flags set. It they are set, 640 640 * there has been a kernel bug or struct page corruption. 641 + * 642 + * __PG_HWPOISON is exceptional because it needs to be kept beyond page's 643 + * alloc-free cycle to prevent from reusing the page. 641 644 */ 642 - #define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) 645 + #define PAGE_FLAGS_CHECK_AT_PREP \ 646 + (((1 << NR_PAGEFLAGS) - 1) & ~__PG_HWPOISON) 643 647 644 648 #define PAGE_FLAGS_PRIVATE \ 645 649 (1 << PG_private | 1 << PG_private_2)
+1 -1
init/main.c
··· 656 656 key_init(); 657 657 security_init(); 658 658 dbg_late_init(); 659 - vfs_caches_init(totalram_pages); 659 + vfs_caches_init(); 660 660 signals_init(); 661 661 /* rootfs populating might need page-writeback */ 662 662 page_writeback_init();
-5
ipc/mqueue.c
··· 142 142 if (!leaf) 143 143 return -ENOMEM; 144 144 INIT_LIST_HEAD(&leaf->msg_list); 145 - info->qsize += sizeof(*leaf); 146 145 } 147 146 leaf->priority = msg->m_type; 148 147 rb_link_node(&leaf->rb_node, parent, p); ··· 186 187 "lazy leaf delete!\n"); 187 188 rb_erase(&leaf->rb_node, &info->msg_tree); 188 189 if (info->node_cache) { 189 - info->qsize -= sizeof(*leaf); 190 190 kfree(leaf); 191 191 } else { 192 192 info->node_cache = leaf; ··· 198 200 if (list_empty(&leaf->msg_list)) { 199 201 rb_erase(&leaf->rb_node, &info->msg_tree); 200 202 if (info->node_cache) { 201 - info->qsize -= sizeof(*leaf); 202 203 kfree(leaf); 203 204 } else { 204 205 info->node_cache = leaf; ··· 1031 1034 /* Save our speculative allocation into the cache */ 1032 1035 INIT_LIST_HEAD(&new_leaf->msg_list); 1033 1036 info->node_cache = new_leaf; 1034 - info->qsize += sizeof(*new_leaf); 1035 1037 new_leaf = NULL; 1036 1038 } else { 1037 1039 kfree(new_leaf); ··· 1138 1142 /* Save our speculative allocation into the cache */ 1139 1143 INIT_LIST_HEAD(&new_leaf->msg_list); 1140 1144 info->node_cache = new_leaf; 1141 - info->qsize += sizeof(*new_leaf); 1142 1145 } else { 1143 1146 kfree(new_leaf); 1144 1147 }
+1 -1
ipc/shm.c
··· 545 545 if ((shmflg & SHM_NORESERVE) && 546 546 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 547 547 acctflag = VM_NORESERVE; 548 - file = shmem_file_setup(name, size, acctflag); 548 + file = shmem_kernel_file_setup(name, size, acctflag); 549 549 } 550 550 error = PTR_ERR(file); 551 551 if (IS_ERR(file))
+4
kernel/kthread.c
··· 97 97 { 98 98 return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags); 99 99 } 100 + EXPORT_SYMBOL_GPL(kthread_should_park); 100 101 101 102 /** 102 103 * kthread_freezable_should_stop - should this freezable kthread return now? ··· 172 171 { 173 172 __kthread_parkme(to_kthread(current)); 174 173 } 174 + EXPORT_SYMBOL_GPL(kthread_parkme); 175 175 176 176 static int kthread(void *_create) 177 177 { ··· 413 411 if (kthread) 414 412 __kthread_unpark(k, kthread); 415 413 } 414 + EXPORT_SYMBOL_GPL(kthread_unpark); 416 415 417 416 /** 418 417 * kthread_park - park a thread created by kthread_create(). ··· 444 441 } 445 442 return ret; 446 443 } 444 + EXPORT_SYMBOL_GPL(kthread_park); 447 445 448 446 /** 449 447 * kthread_stop - stop a thread created by kthread_create().
+8 -5
kernel/signal.c
··· 2748 2748 * Other callers might not initialize the si_lsb field, 2749 2749 * so check explicitly for the right codes here. 2750 2750 */ 2751 - if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) 2751 + if (from->si_signo == SIGBUS && 2752 + (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) 2752 2753 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); 2753 2754 #endif 2754 2755 #ifdef SEGV_BNDERR 2755 - err |= __put_user(from->si_lower, &to->si_lower); 2756 - err |= __put_user(from->si_upper, &to->si_upper); 2756 + if (from->si_signo == SIGSEGV && from->si_code == SEGV_BNDERR) { 2757 + err |= __put_user(from->si_lower, &to->si_lower); 2758 + err |= __put_user(from->si_upper, &to->si_upper); 2759 + } 2757 2760 #endif 2758 2761 break; 2759 2762 case __SI_CHLD: ··· 3020 3017 int, sig, 3021 3018 struct compat_siginfo __user *, uinfo) 3022 3019 { 3023 - siginfo_t info; 3020 + siginfo_t info = {}; 3024 3021 int ret = copy_siginfo_from_user32(&info, uinfo); 3025 3022 if (unlikely(ret)) 3026 3023 return ret; ··· 3064 3061 int, sig, 3065 3062 struct compat_siginfo __user *, uinfo) 3066 3063 { 3067 - siginfo_t info; 3064 + siginfo_t info = {}; 3068 3065 3069 3066 if (copy_siginfo_from_user32(&info, uinfo)) 3070 3067 return -EFAULT;
+1 -1
lib/iommu-common.c
··· 119 119 unsigned long align_mask = 0; 120 120 121 121 if (align_order > 0) 122 - align_mask = 0xffffffffffffffffl >> (64 - align_order); 122 + align_mask = ~0ul >> (BITS_PER_LONG - align_order); 123 123 124 124 /* Sanity check */ 125 125 if (unlikely(npages == 0)) {
+1 -6
mm/huge_memory.c
··· 1676 1676 /* after clearing PageTail the gup refcount can be released */ 1677 1677 smp_mb__after_atomic(); 1678 1678 1679 - /* 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; 1679 + page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; 1685 1680 page_tail->flags |= (page->flags & 1686 1681 ((1L << PG_referenced) | 1687 1682 (1L << PG_swapbacked) |
+18 -14
mm/memory-failure.c
··· 909 909 * directly for tail pages. 910 910 */ 911 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 924 if (get_page_unless_zero(head)) { 913 925 if (PageTail(page)) 914 926 get_page(page); ··· 1146 1134 } 1147 1135 1148 1136 if (!PageHuge(p) && PageTransHuge(hpage)) { 1149 - if (!PageAnon(hpage)) { 1150 - pr_err("MCE: %#lx: non anonymous thp\n", pfn); 1151 - if (TestClearPageHWPoison(p)) 1152 - atomic_long_sub(nr_pages, &num_poisoned_pages); 1153 - put_page(p); 1154 - if (p != hpage) 1155 - put_page(hpage); 1156 - return -EBUSY; 1157 - } 1158 1137 if (unlikely(split_huge_page(hpage))) { 1159 1138 pr_err("MCE: %#lx: thp split failed\n", pfn); 1160 1139 if (TestClearPageHWPoison(p)) ··· 1212 1209 if (!PageHWPoison(p)) { 1213 1210 printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); 1214 1211 atomic_long_sub(nr_pages, &num_poisoned_pages); 1212 + unlock_page(hpage); 1215 1213 put_page(hpage); 1216 - res = 0; 1217 - goto out; 1214 + return 0; 1218 1215 } 1219 1216 if (hwpoison_filter(p)) { 1220 1217 if (TestClearPageHWPoison(p)) ··· 1659 1656 inc_zone_page_state(page, NR_ISOLATED_ANON + 1660 1657 page_is_file_cache(page)); 1661 1658 list_add(&page->lru, &pagelist); 1659 + if (!TestSetPageHWPoison(page)) 1660 + atomic_long_inc(&num_poisoned_pages); 1662 1661 ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, 1663 1662 MIGRATE_SYNC, MR_MEMORY_FAILURE); 1664 1663 if (ret) { ··· 1675 1670 pfn, ret, page->flags); 1676 1671 if (ret > 0) 1677 1672 ret = -EIO; 1678 - } else { 1679 - SetPageHWPoison(page); 1680 - atomic_long_inc(&num_poisoned_pages); 1673 + if (TestClearPageHWPoison(page)) 1674 + atomic_long_dec(&num_poisoned_pages); 1681 1675 } 1682 1676 } else { 1683 1677 pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n",
+9 -1
mm/memory_hotplug.c
··· 446 446 int nr_pages = PAGES_PER_SECTION; 447 447 int nid = pgdat->node_id; 448 448 int zone_type; 449 - unsigned long flags; 449 + unsigned long flags, pfn; 450 450 int ret; 451 451 452 452 zone_type = zone - pgdat->node_zones; ··· 461 461 pgdat_resize_unlock(zone->zone_pgdat, &flags); 462 462 memmap_init_zone(nr_pages, nid, zone_type, 463 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 472 return 0; 465 473 } 466 474
+6 -2
mm/migrate.c
··· 880 880 /* Establish migration ptes or remove ptes */ 881 881 if (page_mapped(page)) { 882 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 885 page_was_mapped = 1; 885 886 } 886 887 ··· 951 950 list_del(&page->lru); 952 951 dec_zone_page_state(page, NR_ISOLATED_ANON + 953 952 page_is_file_cache(page)); 954 - if (reason != MR_MEMORY_FAILURE) 953 + /* Soft-offlined page shouldn't go through lru cache list */ 954 + if (reason == MR_MEMORY_FAILURE) 955 + put_page(page); 956 + else 955 957 putback_lru_page(page); 956 958 } 957 959
+2 -2
mm/page-writeback.c
··· 2063 2063 */ 2064 2064 void __init page_writeback_init(void) 2065 2065 { 2066 + BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); 2067 + 2066 2068 writeback_set_ratelimit(); 2067 2069 register_cpu_notifier(&ratelimit_nb); 2068 - 2069 - BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); 2070 2070 } 2071 2071 2072 2072 /**
+30 -15
mm/page_alloc.c
··· 18 18 #include <linux/mm.h> 19 19 #include <linux/swap.h> 20 20 #include <linux/interrupt.h> 21 - #include <linux/rwsem.h> 22 21 #include <linux/pagemap.h> 23 22 #include <linux/jiffies.h> 24 23 #include <linux/bootmem.h> ··· 980 981 981 982 #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ 982 983 defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) 983 - /* Only safe to use early in boot when initialisation is single-threaded */ 984 + 984 985 static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata; 985 986 986 987 int __meminit early_pfn_to_nid(unsigned long pfn) 987 988 { 989 + static DEFINE_SPINLOCK(early_pfn_lock); 988 990 int nid; 989 991 990 - /* The system will behave unpredictably otherwise */ 991 - BUG_ON(system_state != SYSTEM_BOOTING); 992 - 992 + spin_lock(&early_pfn_lock); 993 993 nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache); 994 - if (nid >= 0) 995 - return nid; 996 - /* just returns 0 */ 997 - return 0; 994 + if (nid < 0) 995 + nid = 0; 996 + spin_unlock(&early_pfn_lock); 997 + 998 + return nid; 998 999 } 999 1000 #endif 1000 1001 ··· 1059 1060 __free_pages_boot_core(page, pfn, 0); 1060 1061 } 1061 1062 1062 - static __initdata DECLARE_RWSEM(pgdat_init_rwsem); 1063 + /* Completion tracking for deferred_init_memmap() threads */ 1064 + static atomic_t pgdat_init_n_undone __initdata; 1065 + static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp); 1066 + 1067 + static inline void __init pgdat_init_report_one_done(void) 1068 + { 1069 + if (atomic_dec_and_test(&pgdat_init_n_undone)) 1070 + complete(&pgdat_init_all_done_comp); 1071 + } 1063 1072 1064 1073 /* Initialise remaining memory on a node */ 1065 1074 static int __init deferred_init_memmap(void *data) ··· 1084 1077 const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); 1085 1078 1086 1079 if (first_init_pfn == ULONG_MAX) { 1087 - up_read(&pgdat_init_rwsem); 1080 + pgdat_init_report_one_done(); 1088 1081 return 0; 1089 1082 } 1090 1083 ··· 1184 1177 1185 1178 pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, 1186 1179 jiffies_to_msecs(jiffies - start)); 1187 - up_read(&pgdat_init_rwsem); 1180 + 1181 + pgdat_init_report_one_done(); 1188 1182 return 0; 1189 1183 } 1190 1184 ··· 1193 1185 { 1194 1186 int nid; 1195 1187 1188 + /* There will be num_node_state(N_MEMORY) threads */ 1189 + atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); 1196 1190 for_each_node_state(nid, N_MEMORY) { 1197 - down_read(&pgdat_init_rwsem); 1198 1191 kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); 1199 1192 } 1200 1193 1201 1194 /* Block until all are initialised */ 1202 - down_write(&pgdat_init_rwsem); 1203 - up_write(&pgdat_init_rwsem); 1195 + wait_for_completion(&pgdat_init_all_done_comp); 1196 + 1197 + /* Reinit limits that are based on free pages after the kernel is up */ 1198 + files_maxfiles_init(); 1204 1199 } 1205 1200 #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ 1206 1201 ··· 1296 1285 bad_reason = "non-NULL mapping"; 1297 1286 if (unlikely(atomic_read(&page->_count) != 0)) 1298 1287 bad_reason = "nonzero _count"; 1288 + if (unlikely(page->flags & __PG_HWPOISON)) { 1289 + bad_reason = "HWPoisoned (hardware-corrupted)"; 1290 + bad_flags = __PG_HWPOISON; 1291 + } 1299 1292 if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { 1300 1293 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; 1301 1294 bad_flags = PAGE_FLAGS_CHECK_AT_PREP;
+2 -2
mm/shmem.c
··· 3363 3363 * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be 3364 3364 * kernel internal. There will be NO LSM permission checks against the 3365 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 3367 - * are provided at the key level rather than the inode level. 3366 + * higher layer. The users are the big_key and shm implementations. LSM 3367 + * checks are provided at the key or shm level rather than the inode. 3368 3368 * @name: name for dentry (to be seen in /proc/<pid>/maps 3369 3369 * @size: size to be set for the file 3370 3370 * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size
+1 -2
mm/slab_common.c
··· 37 37 SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \ 38 38 SLAB_FAILSLAB) 39 39 40 - #define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \ 41 - SLAB_CACHE_DMA | SLAB_NOTRACK) 40 + #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | SLAB_NOTRACK) 42 41 43 42 /* 44 43 * Merge control. If this is set then no merging of slab caches will occur.