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 misc fixes from Andrew Morton:
"22 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (22 commits)
fs/proc/proc_sysctl.c: fix NULL pointer dereference in put_links
fs: fs_parser: fix printk format warning
checkpatch: add %pt as a valid vsprintf extension
mm/migrate.c: add missing flush_dcache_page for non-mapped page migrate
drivers/block/zram/zram_drv.c: fix idle/writeback string compare
mm/page_isolation.c: fix a wrong flag in set_migratetype_isolate()
mm/memory_hotplug.c: fix notification in offline error path
ptrace: take into account saved_sigmask in PTRACE{GET,SET}SIGMASK
fs/proc/kcore.c: make kcore_modules static
include/linux/list.h: fix list_is_first() kernel-doc
mm/debug.c: fix __dump_page when mapping->host is not set
mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified
include/linux/hugetlb.h: convert to use vm_fault_t
iommu/io-pgtable-arm-v7s: request DMA32 memory, and improve debugging
mm: add support for kmem caches in DMA32 zone
ocfs2: fix inode bh swapping mixup in ocfs2_reflink_inodes_lock
mm/hotplug: fix offline undo_isolate_page_range()
fs/open.c: allow opening only regular files during execve()
mailmap: add Changbin Du
mm/debug.c: add a cast to u64 for atomic64_read()
...

+210 -112
+2
.mailmap
··· 224 224 Yusuke Goda <goda.yusuke@renesas.com> 225 225 Gustavo Padovan <gustavo@las.ic.unicamp.br> 226 226 Gustavo Padovan <padovan@profusion.mobi> 227 + Changbin Du <changbin.du@intel.com> <changbin.du@intel.com> 228 + Changbin Du <changbin.du@intel.com> <changbin.du@gmail.com>
+6 -26
drivers/block/zram/zram_drv.c
··· 290 290 struct zram *zram = dev_to_zram(dev); 291 291 unsigned long nr_pages = zram->disksize >> PAGE_SHIFT; 292 292 int index; 293 - char mode_buf[8]; 294 - ssize_t sz; 295 293 296 - sz = strscpy(mode_buf, buf, sizeof(mode_buf)); 297 - if (sz <= 0) 298 - return -EINVAL; 299 - 300 - /* ignore trailing new line */ 301 - if (mode_buf[sz - 1] == '\n') 302 - mode_buf[sz - 1] = 0x00; 303 - 304 - if (strcmp(mode_buf, "all")) 294 + if (!sysfs_streq(buf, "all")) 305 295 return -EINVAL; 306 296 307 297 down_read(&zram->init_lock); ··· 625 635 struct bio bio; 626 636 struct bio_vec bio_vec; 627 637 struct page *page; 628 - ssize_t ret, sz; 629 - char mode_buf[8]; 630 - int mode = -1; 638 + ssize_t ret; 639 + int mode; 631 640 unsigned long blk_idx = 0; 632 641 633 - sz = strscpy(mode_buf, buf, sizeof(mode_buf)); 634 - if (sz <= 0) 635 - return -EINVAL; 636 - 637 - /* ignore trailing newline */ 638 - if (mode_buf[sz - 1] == '\n') 639 - mode_buf[sz - 1] = 0x00; 640 - 641 - if (!strcmp(mode_buf, "idle")) 642 + if (sysfs_streq(buf, "idle")) 642 643 mode = IDLE_WRITEBACK; 643 - else if (!strcmp(mode_buf, "huge")) 644 + else if (sysfs_streq(buf, "huge")) 644 645 mode = HUGE_WRITEBACK; 645 - 646 - if (mode == -1) 646 + else 647 647 return -EINVAL; 648 648 649 649 down_read(&zram->init_lock);
+15 -4
drivers/iommu/io-pgtable-arm-v7s.c
··· 160 160 161 161 #define ARM_V7S_TCR_PD1 BIT(5) 162 162 163 + #ifdef CONFIG_ZONE_DMA32 164 + #define ARM_V7S_TABLE_GFP_DMA GFP_DMA32 165 + #define ARM_V7S_TABLE_SLAB_FLAGS SLAB_CACHE_DMA32 166 + #else 167 + #define ARM_V7S_TABLE_GFP_DMA GFP_DMA 168 + #define ARM_V7S_TABLE_SLAB_FLAGS SLAB_CACHE_DMA 169 + #endif 170 + 163 171 typedef u32 arm_v7s_iopte; 164 172 165 173 static bool selftest_running; ··· 205 197 void *table = NULL; 206 198 207 199 if (lvl == 1) 208 - table = (void *)__get_dma_pages(__GFP_ZERO, get_order(size)); 200 + table = (void *)__get_free_pages( 201 + __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); 209 202 else if (lvl == 2) 210 - table = kmem_cache_zalloc(data->l2_tables, gfp | GFP_DMA); 203 + table = kmem_cache_zalloc(data->l2_tables, gfp); 211 204 phys = virt_to_phys(table); 212 - if (phys != (arm_v7s_iopte)phys) 205 + if (phys != (arm_v7s_iopte)phys) { 213 206 /* Doesn't fit in PTE */ 207 + dev_err(dev, "Page table does not fit in PTE: %pa", &phys); 214 208 goto out_free; 209 + } 215 210 if (table && !(cfg->quirks & IO_PGTABLE_QUIRK_NO_DMA)) { 216 211 dma = dma_map_single(dev, table, size, DMA_TO_DEVICE); 217 212 if (dma_mapping_error(dev, dma)) ··· 744 733 data->l2_tables = kmem_cache_create("io-pgtable_armv7s_l2", 745 734 ARM_V7S_TABLE_SIZE(2), 746 735 ARM_V7S_TABLE_SIZE(2), 747 - SLAB_CACHE_DMA, NULL); 736 + ARM_V7S_TABLE_SLAB_FLAGS, NULL); 748 737 if (!data->l2_tables) 749 738 goto out_free_data; 750 739
+1 -1
fs/fs_parser.c
··· 410 410 for (param = desc->specs; param->name; param++) { 411 411 if (param->opt == e->opt && 412 412 param->type != fs_param_is_enum) { 413 - pr_err("VALIDATE %s: e[%lu] enum val for %s\n", 413 + pr_err("VALIDATE %s: e[%tu] enum val for %s\n", 414 414 name, e - desc->enums, param->name); 415 415 good = false; 416 416 }
+24 -18
fs/ocfs2/refcounttree.c
··· 4719 4719 4720 4720 /* Lock an inode and grab a bh pointing to the inode. */ 4721 4721 int ocfs2_reflink_inodes_lock(struct inode *s_inode, 4722 - struct buffer_head **bh1, 4722 + struct buffer_head **bh_s, 4723 4723 struct inode *t_inode, 4724 - struct buffer_head **bh2) 4724 + struct buffer_head **bh_t) 4725 4725 { 4726 - struct inode *inode1; 4727 - struct inode *inode2; 4726 + struct inode *inode1 = s_inode; 4727 + struct inode *inode2 = t_inode; 4728 4728 struct ocfs2_inode_info *oi1; 4729 4729 struct ocfs2_inode_info *oi2; 4730 + struct buffer_head *bh1 = NULL; 4731 + struct buffer_head *bh2 = NULL; 4730 4732 bool same_inode = (s_inode == t_inode); 4733 + bool need_swap = (inode1->i_ino > inode2->i_ino); 4731 4734 int status; 4732 4735 4733 4736 /* First grab the VFS and rw locks. */ 4734 4737 lock_two_nondirectories(s_inode, t_inode); 4735 - inode1 = s_inode; 4736 - inode2 = t_inode; 4737 - if (inode1->i_ino > inode2->i_ino) 4738 + if (need_swap) 4738 4739 swap(inode1, inode2); 4739 4740 4740 4741 status = ocfs2_rw_lock(inode1, 1); ··· 4758 4757 trace_ocfs2_double_lock((unsigned long long)oi1->ip_blkno, 4759 4758 (unsigned long long)oi2->ip_blkno); 4760 4759 4761 - if (*bh1) 4762 - *bh1 = NULL; 4763 - if (*bh2) 4764 - *bh2 = NULL; 4765 - 4766 4760 /* We always want to lock the one with the lower lockid first. */ 4767 4761 if (oi1->ip_blkno > oi2->ip_blkno) 4768 4762 mlog_errno(-ENOLCK); 4769 4763 4770 4764 /* lock id1 */ 4771 - status = ocfs2_inode_lock_nested(inode1, bh1, 1, OI_LS_REFLINK_TARGET); 4765 + status = ocfs2_inode_lock_nested(inode1, &bh1, 1, 4766 + OI_LS_REFLINK_TARGET); 4772 4767 if (status < 0) { 4773 4768 if (status != -ENOENT) 4774 4769 mlog_errno(status); ··· 4773 4776 4774 4777 /* lock id2 */ 4775 4778 if (!same_inode) { 4776 - status = ocfs2_inode_lock_nested(inode2, bh2, 1, 4779 + status = ocfs2_inode_lock_nested(inode2, &bh2, 1, 4777 4780 OI_LS_REFLINK_TARGET); 4778 4781 if (status < 0) { 4779 4782 if (status != -ENOENT) 4780 4783 mlog_errno(status); 4781 4784 goto out_cl1; 4782 4785 } 4783 - } else 4784 - *bh2 = *bh1; 4786 + } else { 4787 + bh2 = bh1; 4788 + } 4789 + 4790 + /* 4791 + * If we swapped inode order above, we have to swap the buffer heads 4792 + * before passing them back to the caller. 4793 + */ 4794 + if (need_swap) 4795 + swap(bh1, bh2); 4796 + *bh_s = bh1; 4797 + *bh_t = bh2; 4785 4798 4786 4799 trace_ocfs2_double_lock_end( 4787 4800 (unsigned long long)oi1->ip_blkno, ··· 4801 4794 4802 4795 out_cl1: 4803 4796 ocfs2_inode_unlock(inode1, 1); 4804 - brelse(*bh1); 4805 - *bh1 = NULL; 4797 + brelse(bh1); 4806 4798 out_rw2: 4807 4799 ocfs2_rw_unlock(inode2, 1); 4808 4800 out_i2:
+6
fs/open.c
··· 733 733 return 0; 734 734 } 735 735 736 + /* Any file opened for execve()/uselib() has to be a regular file. */ 737 + if (unlikely(f->f_flags & FMODE_EXEC && !S_ISREG(inode->i_mode))) { 738 + error = -EACCES; 739 + goto cleanup_file; 740 + } 741 + 736 742 if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { 737 743 error = get_write_access(inode); 738 744 if (unlikely(error))
+1 -1
fs/proc/kcore.c
··· 615 615 /* 616 616 * MODULES_VADDR has no intersection with VMALLOC_ADDR. 617 617 */ 618 - struct kcore_list kcore_modules; 618 + static struct kcore_list kcore_modules; 619 619 static void __init add_modules_range(void) 620 620 { 621 621 if (MODULES_VADDR != VMALLOC_START && MODULES_END != VMALLOC_END) {
+2 -1
fs/proc/proc_sysctl.c
··· 1626 1626 if (--header->nreg) 1627 1627 return; 1628 1628 1629 - put_links(header); 1629 + if (parent) 1630 + put_links(header); 1630 1631 start_unregistering(header); 1631 1632 if (!--header->count) 1632 1633 kfree_rcu(header, rcu);
+7 -1
include/linux/hugetlb.h
··· 203 203 #define pud_huge(x) 0 204 204 #define is_hugepage_only_range(mm, addr, len) 0 205 205 #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 206 - #define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) 207 206 #define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \ 208 207 src_addr, pagep) ({ BUG(); 0; }) 209 208 #define huge_pte_offset(mm, address, sz) 0 ··· 232 233 unsigned long end, struct page *ref_page) 233 234 { 234 235 BUG(); 236 + } 237 + static inline vm_fault_t hugetlb_fault(struct mm_struct *mm, 238 + struct vm_area_struct *vma, unsigned long address, 239 + unsigned int flags) 240 + { 241 + BUG(); 242 + return 0; 235 243 } 236 244 237 245 #endif /* !CONFIG_HUGETLB_PAGE */
+1 -1
include/linux/list.h
··· 207 207 } 208 208 209 209 /** 210 - * list_is_first -- tests whether @ list is the first entry in list @head 210 + * list_is_first -- tests whether @list is the first entry in list @head 211 211 * @list: the entry to test 212 212 * @head: the head of the list 213 213 */
-10
include/linux/page-isolation.h
··· 41 41 42 42 /* 43 43 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. 44 - * If specified range includes migrate types other than MOVABLE or CMA, 45 - * this will fail with -EBUSY. 46 - * 47 - * For isolating all pages in the range finally, the caller have to 48 - * free all pages in the range. test_page_isolated() can be used for 49 - * test it. 50 - * 51 - * The following flags are allowed (they can be combined in a bit mask) 52 - * SKIP_HWPOISON - ignore hwpoison pages 53 - * REPORT_FAILURE - report details about the failure to isolate the range 54 44 */ 55 45 int 56 46 start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
+18
include/linux/sched/signal.h
··· 418 418 set_thread_flag(TIF_RESTORE_SIGMASK); 419 419 WARN_ON(!test_thread_flag(TIF_SIGPENDING)); 420 420 } 421 + 422 + static inline void clear_tsk_restore_sigmask(struct task_struct *tsk) 423 + { 424 + clear_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK); 425 + } 426 + 421 427 static inline void clear_restore_sigmask(void) 422 428 { 423 429 clear_thread_flag(TIF_RESTORE_SIGMASK); 430 + } 431 + static inline bool test_tsk_restore_sigmask(struct task_struct *tsk) 432 + { 433 + return test_tsk_thread_flag(tsk, TIF_RESTORE_SIGMASK); 424 434 } 425 435 static inline bool test_restore_sigmask(void) 426 436 { ··· 449 439 current->restore_sigmask = true; 450 440 WARN_ON(!test_thread_flag(TIF_SIGPENDING)); 451 441 } 442 + static inline void clear_tsk_restore_sigmask(struct task_struct *tsk) 443 + { 444 + tsk->restore_sigmask = false; 445 + } 452 446 static inline void clear_restore_sigmask(void) 453 447 { 454 448 current->restore_sigmask = false; ··· 460 446 static inline bool test_restore_sigmask(void) 461 447 { 462 448 return current->restore_sigmask; 449 + } 450 + static inline bool test_tsk_restore_sigmask(struct task_struct *tsk) 451 + { 452 + return tsk->restore_sigmask; 463 453 } 464 454 static inline bool test_and_clear_restore_sigmask(void) 465 455 {
+2
include/linux/slab.h
··· 32 32 #define SLAB_HWCACHE_ALIGN ((slab_flags_t __force)0x00002000U) 33 33 /* Use GFP_DMA memory */ 34 34 #define SLAB_CACHE_DMA ((slab_flags_t __force)0x00004000U) 35 + /* Use GFP_DMA32 memory */ 36 + #define SLAB_CACHE_DMA32 ((slab_flags_t __force)0x00008000U) 35 37 /* DEBUG: Store the last owner for bug hunting */ 36 38 #define SLAB_STORE_USER ((slab_flags_t __force)0x00010000U) 37 39 /* Panic if kmem_cache_create() fails */
+13 -2
kernel/ptrace.c
··· 29 29 #include <linux/hw_breakpoint.h> 30 30 #include <linux/cn_proc.h> 31 31 #include <linux/compat.h> 32 + #include <linux/sched/signal.h> 32 33 33 34 /* 34 35 * Access another process' address space via ptrace. ··· 925 924 ret = ptrace_setsiginfo(child, &siginfo); 926 925 break; 927 926 928 - case PTRACE_GETSIGMASK: 927 + case PTRACE_GETSIGMASK: { 928 + sigset_t *mask; 929 + 929 930 if (addr != sizeof(sigset_t)) { 930 931 ret = -EINVAL; 931 932 break; 932 933 } 933 934 934 - if (copy_to_user(datavp, &child->blocked, sizeof(sigset_t))) 935 + if (test_tsk_restore_sigmask(child)) 936 + mask = &child->saved_sigmask; 937 + else 938 + mask = &child->blocked; 939 + 940 + if (copy_to_user(datavp, mask, sizeof(sigset_t))) 935 941 ret = -EFAULT; 936 942 else 937 943 ret = 0; 938 944 939 945 break; 946 + } 940 947 941 948 case PTRACE_SETSIGMASK: { 942 949 sigset_t new_set; ··· 969 960 spin_lock_irq(&child->sighand->siglock); 970 961 child->blocked = new_set; 971 962 spin_unlock_irq(&child->sighand->siglock); 963 + 964 + clear_tsk_restore_sigmask(child); 972 965 973 966 ret = 0; 974 967 break;
+2 -2
mm/debug.c
··· 79 79 pr_warn("ksm "); 80 80 else if (mapping) { 81 81 pr_warn("%ps ", mapping->a_ops); 82 - if (mapping->host->i_dentry.first) { 82 + if (mapping->host && mapping->host->i_dentry.first) { 83 83 struct dentry *dentry; 84 84 dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias); 85 85 pr_warn("name:\"%pd\" ", dentry); ··· 168 168 mm_pgtables_bytes(mm), 169 169 mm->map_count, 170 170 mm->hiwater_rss, mm->hiwater_vm, mm->total_vm, mm->locked_vm, 171 - atomic64_read(&mm->pinned_vm), 171 + (u64)atomic64_read(&mm->pinned_vm), 172 172 mm->data_vm, mm->exec_vm, mm->stack_vm, 173 173 mm->start_code, mm->end_code, mm->start_data, mm->end_data, 174 174 mm->start_brk, mm->brk, mm->start_stack,
+4 -1
mm/kasan/kasan.h
··· 163 163 #endif 164 164 165 165 #ifndef arch_kasan_set_tag 166 - #define arch_kasan_set_tag(addr, tag) ((void *)(addr)) 166 + static inline const void *arch_kasan_set_tag(const void *addr, u8 tag) 167 + { 168 + return addr; 169 + } 167 170 #endif 168 171 #ifndef arch_kasan_reset_tag 169 172 #define arch_kasan_reset_tag(addr) ((void *)(addr))
+6 -5
mm/memory.c
··· 1549 1549 WARN_ON_ONCE(!is_zero_pfn(pte_pfn(*pte))); 1550 1550 goto out_unlock; 1551 1551 } 1552 - entry = *pte; 1553 - goto out_mkwrite; 1554 - } else 1555 - goto out_unlock; 1552 + entry = pte_mkyoung(*pte); 1553 + entry = maybe_mkwrite(pte_mkdirty(entry), vma); 1554 + if (ptep_set_access_flags(vma, addr, pte, entry, 1)) 1555 + update_mmu_cache(vma, addr, pte); 1556 + } 1557 + goto out_unlock; 1556 1558 } 1557 1559 1558 1560 /* Ok, finally just insert the thing.. */ ··· 1563 1561 else 1564 1562 entry = pte_mkspecial(pfn_t_pte(pfn, prot)); 1565 1563 1566 - out_mkwrite: 1567 1564 if (mkwrite) { 1568 1565 entry = pte_mkyoung(entry); 1569 1566 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
+14 -5
mm/memory_hotplug.c
··· 1576 1576 { 1577 1577 unsigned long pfn, nr_pages; 1578 1578 long offlined_pages; 1579 - int ret, node; 1579 + int ret, node, nr_isolate_pageblock; 1580 1580 unsigned long flags; 1581 1581 unsigned long valid_start, valid_end; 1582 1582 struct zone *zone; ··· 1602 1602 ret = start_isolate_page_range(start_pfn, end_pfn, 1603 1603 MIGRATE_MOVABLE, 1604 1604 SKIP_HWPOISON | REPORT_FAILURE); 1605 - if (ret) { 1605 + if (ret < 0) { 1606 1606 reason = "failure to isolate range"; 1607 1607 goto failed_removal; 1608 1608 } 1609 + nr_isolate_pageblock = ret; 1609 1610 1610 1611 arg.start_pfn = start_pfn; 1611 1612 arg.nr_pages = nr_pages; ··· 1658 1657 /* Ok, all of our target is isolated. 1659 1658 We cannot do rollback at this point. */ 1660 1659 offline_isolated_pages(start_pfn, end_pfn); 1661 - /* reset pagetype flags and makes migrate type to be MOVABLE */ 1662 - undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); 1660 + 1661 + /* 1662 + * Onlining will reset pagetype flags and makes migrate type 1663 + * MOVABLE, so just need to decrease the number of isolated 1664 + * pageblocks zone counter here. 1665 + */ 1666 + spin_lock_irqsave(&zone->lock, flags); 1667 + zone->nr_isolate_pageblock -= nr_isolate_pageblock; 1668 + spin_unlock_irqrestore(&zone->lock, flags); 1669 + 1663 1670 /* removal success */ 1664 1671 adjust_managed_page_count(pfn_to_page(start_pfn), -offlined_pages); 1665 1672 zone->present_pages -= offlined_pages; ··· 1699 1690 1700 1691 failed_removal_isolated: 1701 1692 undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); 1693 + memory_notify(MEM_CANCEL_OFFLINE, &arg); 1702 1694 failed_removal: 1703 1695 pr_debug("memory offlining [mem %#010llx-%#010llx] failed due to %s\n", 1704 1696 (unsigned long long) start_pfn << PAGE_SHIFT, 1705 1697 ((unsigned long long) end_pfn << PAGE_SHIFT) - 1, 1706 1698 reason); 1707 - memory_notify(MEM_CANCEL_OFFLINE, &arg); 1708 1699 /* pushback to free area */ 1709 1700 mem_hotplug_done(); 1710 1701 return ret;
+33 -7
mm/mempolicy.c
··· 428 428 return node_isset(nid, *qp->nmask) == !(flags & MPOL_MF_INVERT); 429 429 } 430 430 431 + /* 432 + * queue_pages_pmd() has three possible return values: 433 + * 1 - pages are placed on the right node or queued successfully. 434 + * 0 - THP was split. 435 + * -EIO - is migration entry or MPOL_MF_STRICT was specified and an existing 436 + * page was already on a node that does not follow the policy. 437 + */ 431 438 static int queue_pages_pmd(pmd_t *pmd, spinlock_t *ptl, unsigned long addr, 432 439 unsigned long end, struct mm_walk *walk) 433 440 { ··· 444 437 unsigned long flags; 445 438 446 439 if (unlikely(is_pmd_migration_entry(*pmd))) { 447 - ret = 1; 440 + ret = -EIO; 448 441 goto unlock; 449 442 } 450 443 page = pmd_page(*pmd); ··· 461 454 ret = 1; 462 455 flags = qp->flags; 463 456 /* go to thp migration */ 464 - if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) 457 + if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) { 458 + if (!vma_migratable(walk->vma)) { 459 + ret = -EIO; 460 + goto unlock; 461 + } 462 + 465 463 migrate_page_add(page, qp->pagelist, flags); 464 + } else 465 + ret = -EIO; 466 466 unlock: 467 467 spin_unlock(ptl); 468 468 out: ··· 494 480 ptl = pmd_trans_huge_lock(pmd, vma); 495 481 if (ptl) { 496 482 ret = queue_pages_pmd(pmd, ptl, addr, end, walk); 497 - if (ret) 483 + if (ret > 0) 498 484 return 0; 485 + else if (ret < 0) 486 + return ret; 499 487 } 500 488 501 489 if (pmd_trans_unstable(pmd)) ··· 518 502 continue; 519 503 if (!queue_pages_required(page, qp)) 520 504 continue; 521 - migrate_page_add(page, qp->pagelist, flags); 505 + if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) { 506 + if (!vma_migratable(vma)) 507 + break; 508 + migrate_page_add(page, qp->pagelist, flags); 509 + } else 510 + break; 522 511 } 523 512 pte_unmap_unlock(pte - 1, ptl); 524 513 cond_resched(); 525 - return 0; 514 + return addr != end ? -EIO : 0; 526 515 } 527 516 528 517 static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, ··· 597 576 unsigned long endvma = vma->vm_end; 598 577 unsigned long flags = qp->flags; 599 578 600 - if (!vma_migratable(vma)) 579 + /* 580 + * Need check MPOL_MF_STRICT to return -EIO if possible 581 + * regardless of vma_migratable 582 + */ 583 + if (!vma_migratable(vma) && 584 + !(flags & MPOL_MF_STRICT)) 601 585 return 1; 602 586 603 587 if (endvma > end) ··· 629 603 } 630 604 631 605 /* queue pages from current vma */ 632 - if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) 606 + if (flags & MPOL_MF_VALID) 633 607 return 0; 634 608 return 1; 635 609 }
+8 -3
mm/migrate.c
··· 248 248 pte = swp_entry_to_pte(entry); 249 249 } else if (is_device_public_page(new)) { 250 250 pte = pte_mkdevmap(pte); 251 - flush_dcache_page(new); 252 251 } 253 - } else 254 - flush_dcache_page(new); 252 + } 255 253 256 254 #ifdef CONFIG_HUGETLB_PAGE 257 255 if (PageHuge(new)) { ··· 993 995 */ 994 996 if (!PageMappingFlags(page)) 995 997 page->mapping = NULL; 998 + 999 + if (unlikely(is_zone_device_page(newpage))) { 1000 + if (is_device_public_page(newpage)) 1001 + flush_dcache_page(newpage); 1002 + } else 1003 + flush_dcache_page(newpage); 1004 + 996 1005 } 997 1006 out: 998 1007 return rc;
+1 -1
mm/page_alloc.c
··· 8233 8233 8234 8234 ret = start_isolate_page_range(pfn_max_align_down(start), 8235 8235 pfn_max_align_up(end), migratetype, 0); 8236 - if (ret) 8236 + if (ret < 0) 8237 8237 return ret; 8238 8238 8239 8239 /*
+32 -19
mm/page_isolation.c
··· 59 59 * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. 60 60 * We just check MOVABLE pages. 61 61 */ 62 - if (!has_unmovable_pages(zone, page, arg.pages_found, migratetype, flags)) 62 + if (!has_unmovable_pages(zone, page, arg.pages_found, migratetype, 63 + isol_flags)) 63 64 ret = 0; 64 65 65 66 /* ··· 161 160 return NULL; 162 161 } 163 162 164 - /* 165 - * start_isolate_page_range() -- make page-allocation-type of range of pages 166 - * to be MIGRATE_ISOLATE. 167 - * @start_pfn: The lower PFN of the range to be isolated. 168 - * @end_pfn: The upper PFN of the range to be isolated. 169 - * @migratetype: migrate type to set in error recovery. 163 + /** 164 + * start_isolate_page_range() - make page-allocation-type of range of pages to 165 + * be MIGRATE_ISOLATE. 166 + * @start_pfn: The lower PFN of the range to be isolated. 167 + * @end_pfn: The upper PFN of the range to be isolated. 168 + * start_pfn/end_pfn must be aligned to pageblock_order. 169 + * @migratetype: Migrate type to set in error recovery. 170 + * @flags: The following flags are allowed (they can be combined in 171 + * a bit mask) 172 + * SKIP_HWPOISON - ignore hwpoison pages 173 + * REPORT_FAILURE - report details about the failure to 174 + * isolate the range 170 175 * 171 176 * Making page-allocation-type to be MIGRATE_ISOLATE means free pages in 172 177 * the range will never be allocated. Any free pages and pages freed in the 173 - * future will not be allocated again. 174 - * 175 - * start_pfn/end_pfn must be aligned to pageblock_order. 176 - * Return 0 on success and -EBUSY if any part of range cannot be isolated. 178 + * future will not be allocated again. If specified range includes migrate types 179 + * other than MOVABLE or CMA, this will fail with -EBUSY. For isolating all 180 + * pages in the range finally, the caller have to free all pages in the range. 181 + * test_page_isolated() can be used for test it. 177 182 * 178 183 * There is no high level synchronization mechanism that prevents two threads 179 - * from trying to isolate overlapping ranges. If this happens, one thread 184 + * from trying to isolate overlapping ranges. If this happens, one thread 180 185 * will notice pageblocks in the overlapping range already set to isolate. 181 186 * This happens in set_migratetype_isolate, and set_migratetype_isolate 182 - * returns an error. We then clean up by restoring the migration type on 183 - * pageblocks we may have modified and return -EBUSY to caller. This 187 + * returns an error. We then clean up by restoring the migration type on 188 + * pageblocks we may have modified and return -EBUSY to caller. This 184 189 * prevents two threads from simultaneously working on overlapping ranges. 190 + * 191 + * Return: the number of isolated pageblocks on success and -EBUSY if any part 192 + * of range cannot be isolated. 185 193 */ 186 194 int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, 187 195 unsigned migratetype, int flags) ··· 198 188 unsigned long pfn; 199 189 unsigned long undo_pfn; 200 190 struct page *page; 191 + int nr_isolate_pageblock = 0; 201 192 202 193 BUG_ON(!IS_ALIGNED(start_pfn, pageblock_nr_pages)); 203 194 BUG_ON(!IS_ALIGNED(end_pfn, pageblock_nr_pages)); ··· 207 196 pfn < end_pfn; 208 197 pfn += pageblock_nr_pages) { 209 198 page = __first_valid_page(pfn, pageblock_nr_pages); 210 - if (page && 211 - set_migratetype_isolate(page, migratetype, flags)) { 212 - undo_pfn = pfn; 213 - goto undo; 199 + if (page) { 200 + if (set_migratetype_isolate(page, migratetype, flags)) { 201 + undo_pfn = pfn; 202 + goto undo; 203 + } 204 + nr_isolate_pageblock++; 214 205 } 215 206 } 216 - return 0; 207 + return nr_isolate_pageblock; 217 208 undo: 218 209 for (pfn = start_pfn; 219 210 pfn < undo_pfn;
+2
mm/slab.c
··· 2115 2115 cachep->allocflags = __GFP_COMP; 2116 2116 if (flags & SLAB_CACHE_DMA) 2117 2117 cachep->allocflags |= GFP_DMA; 2118 + if (flags & SLAB_CACHE_DMA32) 2119 + cachep->allocflags |= GFP_DMA32; 2118 2120 if (flags & SLAB_RECLAIM_ACCOUNT) 2119 2121 cachep->allocflags |= __GFP_RECLAIMABLE; 2120 2122 cachep->size = size;
+2 -1
mm/slab.h
··· 127 127 128 128 129 129 /* Legal flag mask for kmem_cache_create(), for various configurations */ 130 - #define SLAB_CORE_FLAGS (SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA | SLAB_PANIC | \ 130 + #define SLAB_CORE_FLAGS (SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA | \ 131 + SLAB_CACHE_DMA32 | SLAB_PANIC | \ 131 132 SLAB_TYPESAFE_BY_RCU | SLAB_DEBUG_OBJECTS ) 132 133 133 134 #if defined(CONFIG_DEBUG_SLAB)
+1 -1
mm/slab_common.c
··· 53 53 SLAB_FAILSLAB | SLAB_KASAN) 54 54 55 55 #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | \ 56 - SLAB_ACCOUNT) 56 + SLAB_CACHE_DMA32 | SLAB_ACCOUNT) 57 57 58 58 /* 59 59 * Merge control. If this is set then no merging of slab caches will occur.
+5
mm/slub.c
··· 3589 3589 if (s->flags & SLAB_CACHE_DMA) 3590 3590 s->allocflags |= GFP_DMA; 3591 3591 3592 + if (s->flags & SLAB_CACHE_DMA32) 3593 + s->allocflags |= GFP_DMA32; 3594 + 3592 3595 if (s->flags & SLAB_RECLAIM_ACCOUNT) 3593 3596 s->allocflags |= __GFP_RECLAIMABLE; 3594 3597 ··· 5682 5679 */ 5683 5680 if (s->flags & SLAB_CACHE_DMA) 5684 5681 *p++ = 'd'; 5682 + if (s->flags & SLAB_CACHE_DMA32) 5683 + *p++ = 'D'; 5685 5684 if (s->flags & SLAB_RECLAIM_ACCOUNT) 5686 5685 *p++ = 'a'; 5687 5686 if (s->flags & SLAB_CONSISTENCY_CHECKS)
+1 -1
mm/sparse.c
··· 567 567 } 568 568 569 569 #ifdef CONFIG_MEMORY_HOTREMOVE 570 - /* Mark all memory sections within the pfn range as online */ 570 + /* Mark all memory sections within the pfn range as offline */ 571 571 void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn) 572 572 { 573 573 unsigned long pfn;
+1 -1
scripts/checkpatch.pl
··· 5977 5977 while ($fmt =~ /(\%[\*\d\.]*p(\w))/g) { 5978 5978 $specifier = $1; 5979 5979 $extension = $2; 5980 - if ($extension !~ /[SsBKRraEhMmIiUDdgVCbGNOx]/) { 5980 + if ($extension !~ /[SsBKRraEhMmIiUDdgVCbGNOxt]/) { 5981 5981 $bad_specifier = $specifier; 5982 5982 last; 5983 5983 }