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:
"14 patches.

Subsystems affected by this patch series: mm (migration, vmscan, slub,
gup, memcg, hugetlbfs), mailmap, kbuild, reboot, watchdog, panic, and
ocfs2"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
ocfs2: initialize ip_next_orphan
panic: don't dump stack twice on warn
hugetlbfs: fix anon huge page migration race
mm: memcontrol: fix missing wakeup polling thread
kernel/watchdog: fix watchdog_allowed_mask not used warning
reboot: fix overflow parsing reboot cpu number
Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint"
compiler.h: fix barrier_data() on clang
mm/gup: use unpin_user_pages() in __gup_longterm_locked()
mm/slub: fix panic in slab_alloc_node()
mailmap: fix entry for Dmitry Baryshkov/Eremin-Solenikov
mm/vmscan: fix NR_ISOLATED_FILE corruption on 64-bit
mm/compaction: stop isolation if too many pages are isolated and we have pages to migrate
mm/compaction: count pages and stop correctly during page isolation

+118 -186
+4 -1
.mailmap
··· 82 82 Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@imgtec.com> 83 83 Dengcheng Zhu <dzhu@wavecomp.com> <dengcheng.zhu@mips.com> 84 84 <dev.kurt@vandijck-laurijssen.be> <kurt.van.dijck@eia.be> 85 - Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 85 + Dmitry Baryshkov <dbaryshkov@gmail.com> 86 + Dmitry Baryshkov <dbaryshkov@gmail.com> <[dbaryshkov@gmail.com]> 87 + Dmitry Baryshkov <dbaryshkov@gmail.com> <dmitry_baryshkov@mentor.com> 88 + Dmitry Baryshkov <dbaryshkov@gmail.com> <dmitry_eremin@mentor.com> 86 89 Dmitry Safonov <0x7f454c46@gmail.com> <dima@arista.com> 87 90 Dmitry Safonov <0x7f454c46@gmail.com> <d.safonov@partner.samsung.com> 88 91 Dmitry Safonov <0x7f454c46@gmail.com> <dsafonov@virtuozzo.com>
+1
fs/ocfs2/super.c
··· 1713 1713 1714 1714 oi->ip_blkno = 0ULL; 1715 1715 oi->ip_clusters = 0; 1716 + oi->ip_next_orphan = NULL; 1716 1717 1717 1718 ocfs2_resv_init_once(&oi->ip_la_data_resv); 1718 1719
+1
include/asm-generic/barrier.h
··· 13 13 14 14 #ifndef __ASSEMBLY__ 15 15 16 + #include <linux/compiler.h> 16 17 #include <asm/rwonce.h> 17 18 18 19 #ifndef nop
-6
include/linux/compiler-clang.h
··· 60 60 #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 61 61 #endif 62 62 63 - /* The following are for compatibility with GCC, from compiler-gcc.h, 64 - * and may be redefined here because they should not be shared with other 65 - * compilers, like ICC. 66 - */ 67 - #define barrier() __asm__ __volatile__("" : : : "memory") 68 - 69 63 #if __has_feature(shadow_call_stack) 70 64 # define __noscs __attribute__((__no_sanitize__("shadow-call-stack"))) 71 65 #endif
-19
include/linux/compiler-gcc.h
··· 15 15 # error Sorry, your version of GCC is too old - please use 4.9 or newer. 16 16 #endif 17 17 18 - /* Optimization barrier */ 19 - 20 - /* The "volatile" is due to gcc bugs */ 21 - #define barrier() __asm__ __volatile__("": : :"memory") 22 - /* 23 - * This version is i.e. to prevent dead stores elimination on @ptr 24 - * where gcc and llvm may behave differently when otherwise using 25 - * normal barrier(): while gcc behavior gets along with a normal 26 - * barrier(), llvm needs an explicit input variable to be assumed 27 - * clobbered. The issue is as follows: while the inline asm might 28 - * access any memory it wants, the compiler could have fit all of 29 - * @ptr into memory registers instead, and since @ptr never escaped 30 - * from that, it proved that the inline asm wasn't touching any of 31 - * it. This version works well with both compilers, i.e. we're telling 32 - * the compiler that the inline asm absolutely may see the contents 33 - * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 34 - */ 35 - #define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") 36 - 37 18 /* 38 19 * This macro obfuscates arithmetic on a variable address so that gcc 39 20 * shouldn't recognize the original var, and make assumptions about it.
+16 -2
include/linux/compiler.h
··· 80 80 81 81 /* Optimization barrier */ 82 82 #ifndef barrier 83 - # define barrier() __memory_barrier() 83 + /* The "volatile" is due to gcc bugs */ 84 + # define barrier() __asm__ __volatile__("": : :"memory") 84 85 #endif 85 86 86 87 #ifndef barrier_data 87 - # define barrier_data(ptr) barrier() 88 + /* 89 + * This version is i.e. to prevent dead stores elimination on @ptr 90 + * where gcc and llvm may behave differently when otherwise using 91 + * normal barrier(): while gcc behavior gets along with a normal 92 + * barrier(), llvm needs an explicit input variable to be assumed 93 + * clobbered. The issue is as follows: while the inline asm might 94 + * access any memory it wants, the compiler could have fit all of 95 + * @ptr into memory registers instead, and since @ptr never escaped 96 + * from that, it proved that the inline asm wasn't touching any of 97 + * it. This version works well with both compilers, i.e. we're telling 98 + * the compiler that the inline asm absolutely may see the contents 99 + * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495 100 + */ 101 + # define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory") 88 102 #endif 89 103 90 104 /* workaround for GCC PR82365 if needed */
+9 -2
include/linux/memcontrol.h
··· 900 900 static inline void memcg_memory_event(struct mem_cgroup *memcg, 901 901 enum memcg_memory_event event) 902 902 { 903 + bool swap_event = event == MEMCG_SWAP_HIGH || event == MEMCG_SWAP_MAX || 904 + event == MEMCG_SWAP_FAIL; 905 + 903 906 atomic_long_inc(&memcg->memory_events_local[event]); 904 - cgroup_file_notify(&memcg->events_local_file); 907 + if (!swap_event) 908 + cgroup_file_notify(&memcg->events_local_file); 905 909 906 910 do { 907 911 atomic_long_inc(&memcg->memory_events[event]); 908 - cgroup_file_notify(&memcg->events_file); 912 + if (swap_event) 913 + cgroup_file_notify(&memcg->swap_events_file); 914 + else 915 + cgroup_file_notify(&memcg->events_file); 909 916 910 917 if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) 911 918 break;
+2 -1
kernel/panic.c
··· 605 605 panic("panic_on_warn set ...\n"); 606 606 } 607 607 608 - dump_stack(); 608 + if (!regs) 609 + dump_stack(); 609 610 610 611 print_irqtrace_events(current); 611 612
+14 -14
kernel/reboot.c
··· 551 551 break; 552 552 553 553 case 's': 554 - { 555 - int rc; 556 - 557 - if (isdigit(*(str+1))) { 558 - rc = kstrtoint(str+1, 0, &reboot_cpu); 559 - if (rc) 560 - return rc; 561 - } else if (str[1] == 'm' && str[2] == 'p' && 562 - isdigit(*(str+3))) { 563 - rc = kstrtoint(str+3, 0, &reboot_cpu); 564 - if (rc) 565 - return rc; 566 - } else 554 + if (isdigit(*(str+1))) 555 + reboot_cpu = simple_strtoul(str+1, NULL, 0); 556 + else if (str[1] == 'm' && str[2] == 'p' && 557 + isdigit(*(str+3))) 558 + reboot_cpu = simple_strtoul(str+3, NULL, 0); 559 + else 567 560 *mode = REBOOT_SOFT; 561 + if (reboot_cpu >= num_possible_cpus()) { 562 + pr_err("Ignoring the CPU number in reboot= option. " 563 + "CPU %d exceeds possible cpu number %d\n", 564 + reboot_cpu, num_possible_cpus()); 565 + reboot_cpu = 0; 566 + break; 567 + } 568 568 break; 569 - } 569 + 570 570 case 'g': 571 571 *mode = REBOOT_GPIO; 572 572 break;
+2 -2
kernel/watchdog.c
··· 44 44 int __read_mostly watchdog_thresh = 10; 45 45 static int __read_mostly nmi_watchdog_available; 46 46 47 - static struct cpumask watchdog_allowed_mask __read_mostly; 48 - 49 47 struct cpumask watchdog_cpumask __read_mostly; 50 48 unsigned long *watchdog_cpumask_bits = cpumask_bits(&watchdog_cpumask); 51 49 ··· 159 161 #ifdef CONFIG_SMP 160 162 int __read_mostly sysctl_softlockup_all_cpu_backtrace; 161 163 #endif 164 + 165 + static struct cpumask watchdog_allowed_mask __read_mostly; 162 166 163 167 /* Global variables, exported for sysctl */ 164 168 unsigned int __read_mostly softlockup_panic =
+8 -4
mm/compaction.c
··· 817 817 * delay for some time until fewer pages are isolated 818 818 */ 819 819 while (unlikely(too_many_isolated(pgdat))) { 820 + /* stop isolation if there are still pages not migrated */ 821 + if (cc->nr_migratepages) 822 + return 0; 823 + 820 824 /* async migration should just abort */ 821 825 if (cc->mode == MIGRATE_ASYNC) 822 826 return 0; ··· 1016 1012 1017 1013 isolate_success: 1018 1014 list_add(&page->lru, &cc->migratepages); 1019 - cc->nr_migratepages++; 1020 - nr_isolated++; 1015 + cc->nr_migratepages += compound_nr(page); 1016 + nr_isolated += compound_nr(page); 1021 1017 1022 1018 /* 1023 1019 * Avoid isolating too much unless this block is being ··· 1025 1021 * or a lock is contended. For contention, isolate quickly to 1026 1022 * potentially remove one source of contention. 1027 1023 */ 1028 - if (cc->nr_migratepages == COMPACT_CLUSTER_MAX && 1024 + if (cc->nr_migratepages >= COMPACT_CLUSTER_MAX && 1029 1025 !cc->rescan && !cc->contended) { 1030 1026 ++low_pfn; 1031 1027 break; ··· 1136 1132 if (!pfn) 1137 1133 break; 1138 1134 1139 - if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) 1135 + if (cc->nr_migratepages >= COMPACT_CLUSTER_MAX) 1140 1136 break; 1141 1137 } 1142 1138
+10 -4
mm/gup.c
··· 1647 1647 /* 1648 1648 * drop the above get_user_pages reference. 1649 1649 */ 1650 - for (i = 0; i < nr_pages; i++) 1651 - put_page(pages[i]); 1650 + if (gup_flags & FOLL_PIN) 1651 + unpin_user_pages(pages, nr_pages); 1652 + else 1653 + for (i = 0; i < nr_pages; i++) 1654 + put_page(pages[i]); 1652 1655 1653 1656 if (migrate_pages(&cma_page_list, alloc_migration_target, NULL, 1654 1657 (unsigned long)&mtc, MIGRATE_SYNC, MR_CONTIG_RANGE)) { ··· 1731 1728 goto out; 1732 1729 1733 1730 if (check_dax_vmas(vmas_tmp, rc)) { 1734 - for (i = 0; i < rc; i++) 1735 - put_page(pages[i]); 1731 + if (gup_flags & FOLL_PIN) 1732 + unpin_user_pages(pages, rc); 1733 + else 1734 + for (i = 0; i < rc; i++) 1735 + put_page(pages[i]); 1736 1736 rc = -EOPNOTSUPP; 1737 1737 goto out; 1738 1738 }
+5 -85
mm/hugetlb.c
··· 1568 1568 } 1569 1569 1570 1570 /* 1571 - * Find address_space associated with hugetlbfs page. 1572 - * Upon entry page is locked and page 'was' mapped although mapped state 1573 - * could change. If necessary, use anon_vma to find vma and associated 1574 - * address space. The returned mapping may be stale, but it can not be 1575 - * invalid as page lock (which is held) is required to destroy mapping. 1576 - */ 1577 - static struct address_space *_get_hugetlb_page_mapping(struct page *hpage) 1578 - { 1579 - struct anon_vma *anon_vma; 1580 - pgoff_t pgoff_start, pgoff_end; 1581 - struct anon_vma_chain *avc; 1582 - struct address_space *mapping = page_mapping(hpage); 1583 - 1584 - /* Simple file based mapping */ 1585 - if (mapping) 1586 - return mapping; 1587 - 1588 - /* 1589 - * Even anonymous hugetlbfs mappings are associated with an 1590 - * underlying hugetlbfs file (see hugetlb_file_setup in mmap 1591 - * code). Find a vma associated with the anonymous vma, and 1592 - * use the file pointer to get address_space. 1593 - */ 1594 - anon_vma = page_lock_anon_vma_read(hpage); 1595 - if (!anon_vma) 1596 - return mapping; /* NULL */ 1597 - 1598 - /* Use first found vma */ 1599 - pgoff_start = page_to_pgoff(hpage); 1600 - pgoff_end = pgoff_start + pages_per_huge_page(page_hstate(hpage)) - 1; 1601 - anon_vma_interval_tree_foreach(avc, &anon_vma->rb_root, 1602 - pgoff_start, pgoff_end) { 1603 - struct vm_area_struct *vma = avc->vma; 1604 - 1605 - mapping = vma->vm_file->f_mapping; 1606 - break; 1607 - } 1608 - 1609 - anon_vma_unlock_read(anon_vma); 1610 - return mapping; 1611 - } 1612 - 1613 - /* 1614 1571 * Find and lock address space (mapping) in write mode. 1615 1572 * 1616 - * Upon entry, the page is locked which allows us to find the mapping 1617 - * even in the case of an anon page. However, locking order dictates 1618 - * the i_mmap_rwsem be acquired BEFORE the page lock. This is hugetlbfs 1619 - * specific. So, we first try to lock the sema while still holding the 1620 - * page lock. If this works, great! If not, then we need to drop the 1621 - * page lock and then acquire i_mmap_rwsem and reacquire page lock. Of 1622 - * course, need to revalidate state along the way. 1573 + * Upon entry, the page is locked which means that page_mapping() is 1574 + * stable. Due to locking order, we can only trylock_write. If we can 1575 + * not get the lock, simply return NULL to caller. 1623 1576 */ 1624 1577 struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage) 1625 1578 { 1626 - struct address_space *mapping, *mapping2; 1579 + struct address_space *mapping = page_mapping(hpage); 1627 1580 1628 - mapping = _get_hugetlb_page_mapping(hpage); 1629 - retry: 1630 1581 if (!mapping) 1631 1582 return mapping; 1632 1583 1633 - /* 1634 - * If no contention, take lock and return 1635 - */ 1636 1584 if (i_mmap_trylock_write(mapping)) 1637 1585 return mapping; 1638 1586 1639 - /* 1640 - * Must drop page lock and wait on mapping sema. 1641 - * Note: Once page lock is dropped, mapping could become invalid. 1642 - * As a hack, increase map count until we lock page again. 1643 - */ 1644 - atomic_inc(&hpage->_mapcount); 1645 - unlock_page(hpage); 1646 - i_mmap_lock_write(mapping); 1647 - lock_page(hpage); 1648 - atomic_add_negative(-1, &hpage->_mapcount); 1649 - 1650 - /* verify page is still mapped */ 1651 - if (!page_mapped(hpage)) { 1652 - i_mmap_unlock_write(mapping); 1653 - return NULL; 1654 - } 1655 - 1656 - /* 1657 - * Get address space again and verify it is the same one 1658 - * we locked. If not, drop lock and retry. 1659 - */ 1660 - mapping2 = _get_hugetlb_page_mapping(hpage); 1661 - if (mapping2 != mapping) { 1662 - i_mmap_unlock_write(mapping); 1663 - mapping = mapping2; 1664 - goto retry; 1665 - } 1666 - 1667 - return mapping; 1587 + return NULL; 1668 1588 } 1669 1589 1670 1590 pgoff_t __basepage_index(struct page *page)
+17 -19
mm/memory-failure.c
··· 1057 1057 if (!PageHuge(hpage)) { 1058 1058 unmap_success = try_to_unmap(hpage, ttu); 1059 1059 } else { 1060 - /* 1061 - * For hugetlb pages, try_to_unmap could potentially call 1062 - * huge_pmd_unshare. Because of this, take semaphore in 1063 - * write mode here and set TTU_RMAP_LOCKED to indicate we 1064 - * have taken the lock at this higer level. 1065 - * 1066 - * Note that the call to hugetlb_page_mapping_lock_write 1067 - * is necessary even if mapping is already set. It handles 1068 - * ugliness of potentially having to drop page lock to obtain 1069 - * i_mmap_rwsem. 1070 - */ 1071 - mapping = hugetlb_page_mapping_lock_write(hpage); 1072 - 1073 - if (mapping) { 1074 - unmap_success = try_to_unmap(hpage, 1060 + if (!PageAnon(hpage)) { 1061 + /* 1062 + * For hugetlb pages in shared mappings, try_to_unmap 1063 + * could potentially call huge_pmd_unshare. Because of 1064 + * this, take semaphore in write mode here and set 1065 + * TTU_RMAP_LOCKED to indicate we have taken the lock 1066 + * at this higer level. 1067 + */ 1068 + mapping = hugetlb_page_mapping_lock_write(hpage); 1069 + if (mapping) { 1070 + unmap_success = try_to_unmap(hpage, 1075 1071 ttu|TTU_RMAP_LOCKED); 1076 - i_mmap_unlock_write(mapping); 1072 + i_mmap_unlock_write(mapping); 1073 + } else { 1074 + pr_info("Memory failure: %#lx: could not lock mapping for mapped huge page\n", pfn); 1075 + unmap_success = false; 1076 + } 1077 1077 } else { 1078 - pr_info("Memory failure: %#lx: could not find mapping for mapped huge page\n", 1079 - pfn); 1080 - unmap_success = false; 1078 + unmap_success = try_to_unmap(hpage, ttu); 1081 1079 } 1082 1080 } 1083 1081 if (!unmap_success)
+24 -20
mm/migrate.c
··· 1328 1328 goto put_anon; 1329 1329 1330 1330 if (page_mapped(hpage)) { 1331 - /* 1332 - * try_to_unmap could potentially call huge_pmd_unshare. 1333 - * Because of this, take semaphore in write mode here and 1334 - * set TTU_RMAP_LOCKED to let lower levels know we have 1335 - * taken the lock. 1336 - */ 1337 - mapping = hugetlb_page_mapping_lock_write(hpage); 1338 - if (unlikely(!mapping)) 1339 - goto unlock_put_anon; 1331 + bool mapping_locked = false; 1332 + enum ttu_flags ttu = TTU_MIGRATION|TTU_IGNORE_MLOCK| 1333 + TTU_IGNORE_ACCESS; 1340 1334 1341 - try_to_unmap(hpage, 1342 - TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS| 1343 - TTU_RMAP_LOCKED); 1335 + if (!PageAnon(hpage)) { 1336 + /* 1337 + * In shared mappings, try_to_unmap could potentially 1338 + * call huge_pmd_unshare. Because of this, take 1339 + * semaphore in write mode here and set TTU_RMAP_LOCKED 1340 + * to let lower levels know we have taken the lock. 1341 + */ 1342 + mapping = hugetlb_page_mapping_lock_write(hpage); 1343 + if (unlikely(!mapping)) 1344 + goto unlock_put_anon; 1345 + 1346 + mapping_locked = true; 1347 + ttu |= TTU_RMAP_LOCKED; 1348 + } 1349 + 1350 + try_to_unmap(hpage, ttu); 1344 1351 page_was_mapped = 1; 1345 - /* 1346 - * Leave mapping locked until after subsequent call to 1347 - * remove_migration_ptes() 1348 - */ 1352 + 1353 + if (mapping_locked) 1354 + i_mmap_unlock_write(mapping); 1349 1355 } 1350 1356 1351 1357 if (!page_mapped(hpage)) 1352 1358 rc = move_to_new_page(new_hpage, hpage, mode); 1353 1359 1354 - if (page_was_mapped) { 1360 + if (page_was_mapped) 1355 1361 remove_migration_ptes(hpage, 1356 - rc == MIGRATEPAGE_SUCCESS ? new_hpage : hpage, true); 1357 - i_mmap_unlock_write(mapping); 1358 - } 1362 + rc == MIGRATEPAGE_SUCCESS ? new_hpage : hpage, false); 1359 1363 1360 1364 unlock_put_anon: 1361 1365 unlock_page(new_hpage);
+1 -4
mm/rmap.c
··· 1413 1413 /* 1414 1414 * If sharing is possible, start and end will be adjusted 1415 1415 * accordingly. 1416 - * 1417 - * If called for a huge page, caller must hold i_mmap_rwsem 1418 - * in write mode as it is possible to call huge_pmd_unshare. 1419 1416 */ 1420 1417 adjust_range_if_pmd_sharing_possible(vma, &range.start, 1421 1418 &range.end); ··· 1459 1462 subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte); 1460 1463 address = pvmw.address; 1461 1464 1462 - if (PageHuge(page)) { 1465 + if (PageHuge(page) && !PageAnon(page)) { 1463 1466 /* 1464 1467 * To call huge_pmd_unshare, i_mmap_rwsem must be 1465 1468 * held in write mode. Caller needs to explicitly
+1 -1
mm/slub.c
··· 2852 2852 2853 2853 object = c->freelist; 2854 2854 page = c->page; 2855 - if (unlikely(!object || !node_match(page, node))) { 2855 + if (unlikely(!object || !page || !node_match(page, node))) { 2856 2856 object = __slab_alloc(s, gfpflags, node, addr, c); 2857 2857 } else { 2858 2858 void *next_object = get_freepointer_safe(s, object);
+3 -2
mm/vmscan.c
··· 1516 1516 nr_reclaimed = shrink_page_list(&clean_pages, zone->zone_pgdat, &sc, 1517 1517 TTU_IGNORE_ACCESS, &stat, true); 1518 1518 list_splice(&clean_pages, page_list); 1519 - mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, -nr_reclaimed); 1519 + mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, 1520 + -(long)nr_reclaimed); 1520 1521 /* 1521 1522 * Since lazyfree pages are isolated from file LRU from the beginning, 1522 1523 * they will rotate back to anonymous LRU in the end if it failed to ··· 1527 1526 mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_ANON, 1528 1527 stat.nr_lazyfree_fail); 1529 1528 mod_node_page_state(zone->zone_pgdat, NR_ISOLATED_FILE, 1530 - -stat.nr_lazyfree_fail); 1529 + -(long)stat.nr_lazyfree_fail); 1531 1530 return nr_reclaimed; 1532 1531 } 1533 1532