History

Merge branch 'akpm' (patches from Andrew)

Merge fixes from Andrew Morton: "10 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: dax: move writeback calls into the filesystems dax: give DAX clearing code correct bdev ext4: online defrag not supported with DAX ext2, ext4: only set S_DAX for regular inodes block: disable block device DAX by default ocfs2: unlock inode if deleting inode from orphan fails mm: ASLR: use get_random_long() drivers: char: random: add get_random_long() mm: numa: quickly fail allocations for NUMA balancing on full nodes mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED

Linus Torvalds committed 10 years ago

Commit 691429e2 parents 1c27147 7f6d5b524 files · +132 −46Browse files

Unified · Split

24 files
  1. arch/arm/mm/mmap.c +1 −1
  2. arch/arm64/mm/mmap.c +2 −2
  3. arch/mips/mm/mmap.c +2 −2
  4. arch/powerpc/kernel/process.c +2 −2
  5. arch/powerpc/mm/mmap.c +2 −2
  6. arch/sparc/kernel/sys_sparc_64.c +1 −1
  7. arch/x86/mm/mmap.c +3 −3
  8. block/Kconfig +13 −0
  9. drivers/char/random.c +22 −0
  10. fs/binfmt_elf.c +1 −1
  11. fs/block_dev.c +17 −2
  12. fs/dax.c +11 −10
  13. fs/ext2/inode.c +13 −3
  14. fs/ext4/inode.c +5 −1
  15. fs/ext4/ioctl.c +5 −0
  16. fs/ocfs2/aops.c +1 −0
  17. fs/xfs/xfs_aops.c +5 −1
  18. fs/xfs/xfs_aops.h +1 −0
  19. fs/xfs/xfs_bmap_util.c +2 −1
  20. include/linux/dax.h +5 −3
  21. include/linux/random.h +1 −0
  22. mm/filemap.c +4 −8
  23. mm/memory.c +12 −2
  24. mm/migrate.c +1 −1
arch/arm/mm/mmap.c+1−1
@@ -173,7 +173,7 @@ unsigned long arch_mmap_rnd(void) · 172 unmodified lines
173{173{
174 unsigned long rnd;174 unsigned long rnd;
175 175
176 rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_bits) - 1);176 rnd = get_random_long() & ((1UL << mmap_rnd_bits) - 1);
177 177
178 return rnd << PAGE_SHIFT;178 return rnd << PAGE_SHIFT;
179}179}
arch/arm64/mm/mmap.c+2−2
@@ -53,10 +53,10 @@ unsigned long arch_mmap_rnd(void) · 52 unmodified lines
53 53
54#ifdef CONFIG_COMPAT54#ifdef CONFIG_COMPAT
55 if (test_thread_flag(TIF_32BIT))55 if (test_thread_flag(TIF_32BIT))
56 rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_compat_bits) - 1);56 rnd = get_random_long() & ((1UL << mmap_rnd_compat_bits) - 1);
57 else57 else
58#endif58#endif
59 rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_bits) - 1);59 rnd = get_random_long() & ((1UL << mmap_rnd_bits) - 1);
60 return rnd << PAGE_SHIFT;60 return rnd << PAGE_SHIFT;
61}61}
62 62
arch/mips/mm/mmap.c+2−2
@@ -146,7 +146,7 @@ unsigned long arch_mmap_rnd(void) · 145 unmodified lines
146{146{
147 unsigned long rnd;147 unsigned long rnd;
148 148
149 rnd = (unsigned long)get_random_int();149 rnd = get_random_long();
150 rnd <<= PAGE_SHIFT;150 rnd <<= PAGE_SHIFT;
151 if (TASK_IS_32BIT_ADDR)151 if (TASK_IS_32BIT_ADDR)
152 rnd &= 0xfffffful;152 rnd &= 0xfffffful;
@@ -174,7 +174,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm) · 21 unmodified lines
174 174
175static inline unsigned long brk_rnd(void)175static inline unsigned long brk_rnd(void)
176{176{
177 unsigned long rnd = get_random_int();177 unsigned long rnd = get_random_long();
178 178
179 rnd = rnd << PAGE_SHIFT;179 rnd = rnd << PAGE_SHIFT;
180 /* 8MB for 32bit, 256MB for 64bit */180 /* 8MB for 32bit, 256MB for 64bit */
arch/powerpc/kernel/process.c+2−2
@@ -1768,9 +1768,9 @@ static inline unsigned long brk_rnd(void) · 1767 unmodified lines
1768 1768
1769 /* 8MB for 32bit, 1GB for 64bit */1769 /* 8MB for 32bit, 1GB for 64bit */
1770 if (is_32bit_task())1770 if (is_32bit_task())
1771 rnd = (long)(get_random_int() % (1<<(23-PAGE_SHIFT)));1771 rnd = (get_random_long() % (1UL<<(23-PAGE_SHIFT)));
1772 else1772 else
1773 rnd = (long)(get_random_int() % (1<<(30-PAGE_SHIFT)));1773 rnd = (get_random_long() % (1UL<<(30-PAGE_SHIFT)));
1774 1774
1775 return rnd << PAGE_SHIFT;1775 return rnd << PAGE_SHIFT;
1776}1776}
arch/powerpc/mm/mmap.c+2−2
@@ -59,9 +59,9 @@ unsigned long arch_mmap_rnd(void) · 58 unmodified lines
59 59
60 /* 8MB for 32bit, 1GB for 64bit */60 /* 8MB for 32bit, 1GB for 64bit */
61 if (is_32bit_task())61 if (is_32bit_task())
62 rnd = (unsigned long)get_random_int() % (1<<(23-PAGE_SHIFT));62 rnd = get_random_long() % (1<<(23-PAGE_SHIFT));
63 else63 else
64 rnd = (unsigned long)get_random_int() % (1<<(30-PAGE_SHIFT));64 rnd = get_random_long() % (1UL<<(30-PAGE_SHIFT));
65 65
66 return rnd << PAGE_SHIFT;66 return rnd << PAGE_SHIFT;
67}67}
arch/sparc/kernel/sys_sparc_64.c+1−1
@@ -264,7 +264,7 @@ static unsigned long mmap_rnd(void) · 263 unmodified lines
264 unsigned long rnd = 0UL;264 unsigned long rnd = 0UL;
265 265
266 if (current->flags & PF_RANDOMIZE) {266 if (current->flags & PF_RANDOMIZE) {
267 unsigned long val = get_random_int();267 unsigned long val = get_random_long();
268 if (test_thread_flag(TIF_32BIT))268 if (test_thread_flag(TIF_32BIT))
269 rnd = (val % (1UL << (23UL-PAGE_SHIFT)));269 rnd = (val % (1UL << (23UL-PAGE_SHIFT)));
270 else270 else
arch/x86/mm/mmap.c+3−3
@@ -71,12 +71,12 @@ unsigned long arch_mmap_rnd(void) · 70 unmodified lines
71 71
72 if (mmap_is_ia32())72 if (mmap_is_ia32())
73#ifdef CONFIG_COMPAT73#ifdef CONFIG_COMPAT
74 rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_compat_bits) - 1);74 rnd = get_random_long() & ((1UL << mmap_rnd_compat_bits) - 1);
75#else75#else
76 rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_bits) - 1);76 rnd = get_random_long() & ((1UL << mmap_rnd_bits) - 1);
77#endif77#endif
78 else78 else
79 rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_bits) - 1);79 rnd = get_random_long() & ((1UL << mmap_rnd_bits) - 1);
80 80
81 return rnd << PAGE_SHIFT;81 return rnd << PAGE_SHIFT;
82}82}
block/Kconfig+13−0
@@ -88,6 +88,19 @@ config BLK_DEV_INTEGRITY · 87 unmodified lines
88 T10/SCSI Data Integrity Field or the T13/ATA External Path88 T10/SCSI Data Integrity Field or the T13/ATA External Path
89 Protection. If in doubt, say N.89 Protection. If in doubt, say N.
90 90
91config BLK_DEV_DAX
92 bool "Block device DAX support"
93 depends on FS_DAX
94 depends on BROKEN
95 help
96 When DAX support is available (CONFIG_FS_DAX) raw block
97 devices can also support direct userspace access to the
98 storage capacity via MMAP(2) similar to a file on a
99 DAX-enabled filesystem. However, the DAX I/O-path disables
100 some standard I/O-statistics, and the MMAP(2) path has some
101 operational differences due to bypassing the page
102 cache. If in doubt, say N.
103
91config BLK_DEV_THROTTLING104config BLK_DEV_THROTTLING
92 bool "Block layer bio throttling support"105 bool "Block layer bio throttling support"
93 depends on BLK_CGROUP=y106 depends on BLK_CGROUP=y
drivers/char/random.c+22−0
@@ -1818,6 +1818,28 @@ unsigned int get_random_int(void) · 1817 unmodified lines
1818}1818}
1819EXPORT_SYMBOL(get_random_int);1819EXPORT_SYMBOL(get_random_int);
1820 1820
1821/*
1822 * Same as get_random_int(), but returns unsigned long.
1823 */
1824unsigned long get_random_long(void)
1825{
1826 __u32 *hash;
1827 unsigned long ret;
1828
1829 if (arch_get_random_long(&ret))
1830 return ret;
1831
1832 hash = get_cpu_var(get_random_int_hash);
1833
1834 hash[0] += current->pid + jiffies + random_get_entropy();
1835 md5_transform(hash, random_int_secret);
1836 ret = *(unsigned long *)hash;
1837 put_cpu_var(get_random_int_hash);
1838
1839 return ret;
1840}
1841EXPORT_SYMBOL(get_random_long);
1842
1821/*1843/*
1822 * randomize_range() returns a start address such that1844 * randomize_range() returns a start address such that
1823 *1845 *
fs/binfmt_elf.c+1−1
@@ -653,7 +653,7 @@ static unsigned long randomize_stack_top(unsigned long stack_top) · 652 unmodified lines
653 653
654 if ((current->flags & PF_RANDOMIZE) &&654 if ((current->flags & PF_RANDOMIZE) &&
655 !(current->personality & ADDR_NO_RANDOMIZE)) {655 !(current->personality & ADDR_NO_RANDOMIZE)) {
656 random_variable = (unsigned long) get_random_int();656 random_variable = get_random_long();
657 random_variable &= STACK_RND_MASK;657 random_variable &= STACK_RND_MASK;
658 random_variable <<= PAGE_SHIFT;658 random_variable <<= PAGE_SHIFT;
659 }659 }
fs/block_dev.c+17−2
@@ -1201,7 +1201,11 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) · 1200 unmodified lines
1201 bdev->bd_disk = disk;1201 bdev->bd_disk = disk;
1202 bdev->bd_queue = disk->queue;1202 bdev->bd_queue = disk->queue;
1203 bdev->bd_contains = bdev;1203 bdev->bd_contains = bdev;
1204 bdev->bd_inode->i_flags = disk->fops->direct_access ? S_DAX : 0;1204 if (IS_ENABLED(CONFIG_BLK_DEV_DAX) && disk->fops->direct_access)
1205 bdev->bd_inode->i_flags = S_DAX;
1206 else
1207 bdev->bd_inode->i_flags = 0;
1208
1205 if (!partno) {1209 if (!partno) {
1206 ret = -ENXIO;1210 ret = -ENXIO;
1207 bdev->bd_part = disk_get_part(disk, partno);1211 bdev->bd_part = disk_get_part(disk, partno);
@@ -1693,13 +1697,24 @@ static int blkdev_releasepage(struct page *page, gfp_t wait) · 485 unmodified lines
1693 return try_to_free_buffers(page);1697 return try_to_free_buffers(page);
1694}1698}
1695 1699
1700static int blkdev_writepages(struct address_space *mapping,
1701 struct writeback_control *wbc)
1702{
1703 if (dax_mapping(mapping)) {
1704 struct block_device *bdev = I_BDEV(mapping->host);
1705
1706 return dax_writeback_mapping_range(mapping, bdev, wbc);
1707 }
1708 return generic_writepages(mapping, wbc);
1709}
1710
1696static const struct address_space_operations def_blk_aops = {1711static const struct address_space_operations def_blk_aops = {
1697 .readpage = blkdev_readpage,1712 .readpage = blkdev_readpage,
1698 .readpages = blkdev_readpages,1713 .readpages = blkdev_readpages,
1699 .writepage = blkdev_writepage,1714 .writepage = blkdev_writepage,
1700 .write_begin = blkdev_write_begin,1715 .write_begin = blkdev_write_begin,
1701 .write_end = blkdev_write_end,1716 .write_end = blkdev_write_end,
1702 .writepages = generic_writepages,1717 .writepages = blkdev_writepages,
1703 .releasepage = blkdev_releasepage,1718 .releasepage = blkdev_releasepage,
1704 .direct_IO = blkdev_direct_IO,1719 .direct_IO = blkdev_direct_IO,
1705 .is_dirty_writeback = buffer_check_dirty_writeback,1720 .is_dirty_writeback = buffer_check_dirty_writeback,
fs/dax.c+11−10
@@ -79,15 +79,14 @@ struct page *read_dax_sector(struct block_device *bdev, sector_t n) · 78 unmodified lines
79}79}
80 80
81/*81/*
82 * dax_clear_blocks() is called from within transaction context from XFS,82 * dax_clear_sectors() is called from within transaction context from XFS,
83 * and hence this means the stack from this point must follow GFP_NOFS83 * and hence this means the stack from this point must follow GFP_NOFS
84 * semantics for all operations.84 * semantics for all operations.
85 */85 */
86int dax_clear_blocks(struct inode *inode, sector_t block, long _size)86int dax_clear_sectors(struct block_device *bdev, sector_t _sector, long _size)
87{87{
88 struct block_device *bdev = inode->i_sb->s_bdev;
89 struct blk_dax_ctl dax = {88 struct blk_dax_ctl dax = {
90 .sector = block << (inode->i_blkbits - 9),89 .sector = _sector,
91 .size = _size,90 .size = _size,
92 };91 };
93 92
@@ -109,7 +108,7 @@ int dax_clear_blocks(struct inode *inode, sector_t block, long _size) · 15 unmodified lines
109 wmb_pmem();108 wmb_pmem();
110 return 0;109 return 0;
111}110}
112EXPORT_SYMBOL_GPL(dax_clear_blocks);111EXPORT_SYMBOL_GPL(dax_clear_sectors);
113 112
114/* the clear_pmem() calls are ordered by a wmb_pmem() in the caller */113/* the clear_pmem() calls are ordered by a wmb_pmem() in the caller */
115static void dax_new_buf(void __pmem *addr, unsigned size, unsigned first,114static void dax_new_buf(void __pmem *addr, unsigned size, unsigned first,
@@ -485,11 +484,10 @@ static int dax_writeback_one(struct block_device *bdev, · 369 unmodified lines
485 * end]. This is required by data integrity operations to ensure file data is484 * end]. This is required by data integrity operations to ensure file data is
486 * on persistent storage prior to completion of the operation.485 * on persistent storage prior to completion of the operation.
487 */486 */
488int dax_writeback_mapping_range(struct address_space *mapping, loff_t start,487int dax_writeback_mapping_range(struct address_space *mapping,
489 loff_t end)488 struct block_device *bdev, struct writeback_control *wbc)
490{489{
491 struct inode *inode = mapping->host;490 struct inode *inode = mapping->host;
492 struct block_device *bdev = inode->i_sb->s_bdev;
493 pgoff_t start_index, end_index, pmd_index;491 pgoff_t start_index, end_index, pmd_index;
494 pgoff_t indices[PAGEVEC_SIZE];492 pgoff_t indices[PAGEVEC_SIZE];
495 struct pagevec pvec;493 struct pagevec pvec;
@@ -500,8 +498,11 @@ int dax_writeback_mapping_range(struct address_space *mapping, loff_t start, · 4 unmodified lines
500 if (WARN_ON_ONCE(inode->i_blkbits != PAGE_SHIFT))498 if (WARN_ON_ONCE(inode->i_blkbits != PAGE_SHIFT))
501 return -EIO;499 return -EIO;
502 500
503 start_index = start >> PAGE_CACHE_SHIFT;501 if (!mapping->nrexceptional || wbc->sync_mode != WB_SYNC_ALL)
504 end_index = end >> PAGE_CACHE_SHIFT;502 return 0;
503
504 start_index = wbc->range_start >> PAGE_CACHE_SHIFT;
505 end_index = wbc->range_end >> PAGE_CACHE_SHIFT;
505 pmd_index = DAX_PMD_INDEX(start_index);506 pmd_index = DAX_PMD_INDEX(start_index);
506 507
507 rcu_read_lock();508 rcu_read_lock();
fs/ext2/inode.c+13−3
@@ -737,8 +737,10 @@ static int ext2_get_blocks(struct inode *inode, · 736 unmodified lines
737 * so that it's not found by another thread before it's737 * so that it's not found by another thread before it's
738 * initialised738 * initialised
739 */739 */
740 err = dax_clear_blocks(inode, le32_to_cpu(chain[depth-1].key),740 err = dax_clear_sectors(inode->i_sb->s_bdev,
741 1 << inode->i_blkbits);741 le32_to_cpu(chain[depth-1].key) <<
742 (inode->i_blkbits - 9),
743 1 << inode->i_blkbits);
742 if (err) {744 if (err) {
743 mutex_unlock(&ei->truncate_mutex);745 mutex_unlock(&ei->truncate_mutex);
744 goto cleanup;746 goto cleanup;
@@ -874,6 +876,14 @@ ext2_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset) · 129 unmodified lines
874static int876static int
875ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)877ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
876{878{
879#ifdef CONFIG_FS_DAX
880 if (dax_mapping(mapping)) {
881 return dax_writeback_mapping_range(mapping,
882 mapping->host->i_sb->s_bdev,
883 wbc);
884 }
885#endif
886
877 return mpage_writepages(mapping, wbc, ext2_get_block);887 return mpage_writepages(mapping, wbc, ext2_get_block);
878}888}
879 889
@@ -1296,7 +1306,7 @@ void ext2_set_inode_flags(struct inode *inode) · 416 unmodified lines
1296 inode->i_flags |= S_NOATIME;1306 inode->i_flags |= S_NOATIME;
1297 if (flags & EXT2_DIRSYNC_FL)1307 if (flags & EXT2_DIRSYNC_FL)
1298 inode->i_flags |= S_DIRSYNC;1308 inode->i_flags |= S_DIRSYNC;
1299 if (test_opt(inode->i_sb, DAX))1309 if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode))
1300 inode->i_flags |= S_DAX;1310 inode->i_flags |= S_DAX;
1301}1311}
1302 1312
fs/ext4/inode.c+5−1
@@ -2478,6 +2478,10 @@ static int ext4_writepages(struct address_space *mapping, · 2477 unmodified lines
2478 2478
2479 trace_ext4_writepages(inode, wbc);2479 trace_ext4_writepages(inode, wbc);
2480 2480
2481 if (dax_mapping(mapping))
2482 return dax_writeback_mapping_range(mapping, inode->i_sb->s_bdev,
2483 wbc);
2484
2481 /*2485 /*
2482 * No pages to write? This is mainly a kludge to avoid starting2486 * No pages to write? This is mainly a kludge to avoid starting
2483 * a transaction for special inodes like journal inode on last iput()2487 * a transaction for special inodes like journal inode on last iput()
@@ -4155,7 +4159,7 @@ void ext4_set_inode_flags(struct inode *inode) · 1671 unmodified lines
4155 new_fl |= S_NOATIME;4159 new_fl |= S_NOATIME;
4156 if (flags & EXT4_DIRSYNC_FL)4160 if (flags & EXT4_DIRSYNC_FL)
4157 new_fl |= S_DIRSYNC;4161 new_fl |= S_DIRSYNC;
4158 if (test_opt(inode->i_sb, DAX))4162 if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode))
4159 new_fl |= S_DAX;4163 new_fl |= S_DAX;
4160 inode_set_flags(inode, new_fl,4164 inode_set_flags(inode, new_fl,
4161 S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX);4165 S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX);
fs/ext4/ioctl.c+5−0
@@ -583,6 +583,11 @@ group_extend_out: · 582 unmodified lines
583 "Online defrag not supported with bigalloc");583 "Online defrag not supported with bigalloc");
584 err = -EOPNOTSUPP;584 err = -EOPNOTSUPP;
585 goto mext_out;585 goto mext_out;
586 } else if (IS_DAX(inode)) {
587 ext4_msg(sb, KERN_ERR,
588 "Online defrag not supported with DAX");
589 err = -EOPNOTSUPP;
590 goto mext_out;
586 }591 }
587 592
588 err = mnt_want_write_file(filp);593 err = mnt_want_write_file(filp);
fs/ocfs2/aops.c+1−0
@@ -956,6 +956,7 @@ clean_orphan: · 955 unmodified lines
956 tmp_ret = ocfs2_del_inode_from_orphan(osb, inode, di_bh,956 tmp_ret = ocfs2_del_inode_from_orphan(osb, inode, di_bh,
957 update_isize, end);957 update_isize, end);
958 if (tmp_ret < 0) {958 if (tmp_ret < 0) {
959 ocfs2_inode_unlock(inode, 1);
959 ret = tmp_ret;960 ret = tmp_ret;
960 mlog_errno(ret);961 mlog_errno(ret);
961 brelse(di_bh);962 brelse(di_bh);
fs/xfs/xfs_aops.c+5−1
@@ -55,7 +55,7 @@ xfs_count_page_state( · 54 unmodified lines
55 } while ((bh = bh->b_this_page) != head);55 } while ((bh = bh->b_this_page) != head);
56}56}
57 57
58STATIC struct block_device *58struct block_device *
59xfs_find_bdev_for_inode(59xfs_find_bdev_for_inode(
60 struct inode *inode)60 struct inode *inode)
61{61{
@@ -1208,6 +1208,10 @@ xfs_vm_writepages( · 1146 unmodified lines
1208 struct writeback_control *wbc)1208 struct writeback_control *wbc)
1209{1209{
1210 xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED);1210 xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED);
1211 if (dax_mapping(mapping))
1212 return dax_writeback_mapping_range(mapping,
1213 xfs_find_bdev_for_inode(mapping->host), wbc);
1214
1211 return generic_writepages(mapping, wbc);1215 return generic_writepages(mapping, wbc);
1212}1216}
1213 1217
fs/xfs/xfs_aops.h+1−0
@@ -62,5 +62,6 @@ int xfs_get_blocks_dax_fault(struct inode *inode, sector_t offset, · 61 unmodified lines
62 struct buffer_head *map_bh, int create);62 struct buffer_head *map_bh, int create);
63 63
64extern void xfs_count_page_state(struct page *, int *, int *);64extern void xfs_count_page_state(struct page *, int *, int *);
65extern struct block_device *xfs_find_bdev_for_inode(struct inode *);
65 66
66#endif /* __XFS_AOPS_H__ */67#endif /* __XFS_AOPS_H__ */
fs/xfs/xfs_bmap_util.c+2−1
@@ -75,7 +75,8 @@ xfs_zero_extent( · 74 unmodified lines
75 ssize_t size = XFS_FSB_TO_B(mp, count_fsb);75 ssize_t size = XFS_FSB_TO_B(mp, count_fsb);
76 76
77 if (IS_DAX(VFS_I(ip)))77 if (IS_DAX(VFS_I(ip)))
78 return dax_clear_blocks(VFS_I(ip), block, size);78 return dax_clear_sectors(xfs_find_bdev_for_inode(VFS_I(ip)),
79 sector, size);
79 80
80 /*81 /*
81 * let the block layer decide on the fastest method of82 * let the block layer decide on the fastest method of
include/linux/dax.h+5−3
@@ -7,7 +7,7 @@ · 6 unmodified lines
7 7
8ssize_t dax_do_io(struct kiocb *, struct inode *, struct iov_iter *, loff_t,8ssize_t dax_do_io(struct kiocb *, struct inode *, struct iov_iter *, loff_t,
9 get_block_t, dio_iodone_t, int flags);9 get_block_t, dio_iodone_t, int flags);
10int dax_clear_blocks(struct inode *, sector_t block, long size);10int dax_clear_sectors(struct block_device *bdev, sector_t _sector, long _size);
11int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t);11int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t);
12int dax_truncate_page(struct inode *, loff_t from, get_block_t);12int dax_truncate_page(struct inode *, loff_t from, get_block_t);
13int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t,13int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t,
@@ -52,6 +52,8 @@ static inline bool dax_mapping(struct address_space *mapping) · 38 unmodified lines
52{52{
53 return mapping->host && IS_DAX(mapping->host);53 return mapping->host && IS_DAX(mapping->host);
54}54}
55int dax_writeback_mapping_range(struct address_space *mapping, loff_t start,55
56 loff_t end);56struct writeback_control;
57int dax_writeback_mapping_range(struct address_space *mapping,
58 struct block_device *bdev, struct writeback_control *wbc);
57#endif59#endif
include/linux/random.h+1−0
@@ -34,6 +34,7 @@ extern const struct file_operations random_fops, urandom_fops; · 33 unmodified lines
34#endif34#endif
35 35
36unsigned int get_random_int(void);36unsigned int get_random_int(void);
37unsigned long get_random_long(void);
37unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);38unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
38 39
39u32 prandom_u32(void);40u32 prandom_u32(void);
mm/filemap.c+4−8
@@ -446,7 +446,8 @@ int filemap_write_and_wait(struct address_space *mapping) · 445 unmodified lines
446{446{
447 int err = 0;447 int err = 0;
448 448
449 if (mapping->nrpages) {449 if ((!dax_mapping(mapping) && mapping->nrpages) ||
450 (dax_mapping(mapping) && mapping->nrexceptional)) {
450 err = filemap_fdatawrite(mapping);451 err = filemap_fdatawrite(mapping);
451 /*452 /*
452 * Even if the above returned error, the pages may be453 * Even if the above returned error, the pages may be
@@ -482,13 +483,8 @@ int filemap_write_and_wait_range(struct address_space *mapping, · 29 unmodified lines
482{483{
483 int err = 0;484 int err = 0;
484 485
485 if (dax_mapping(mapping) && mapping->nrexceptional) {486 if ((!dax_mapping(mapping) && mapping->nrpages) ||
486 err = dax_writeback_mapping_range(mapping, lstart, lend);487 (dax_mapping(mapping) && mapping->nrexceptional)) {
487 if (err)
488 return err;
489 }
490
491 if (mapping->nrpages) {
492 err = __filemap_fdatawrite_range(mapping, lstart, lend,488 err = __filemap_fdatawrite_range(mapping, lstart, lend,
493 WB_SYNC_ALL);489 WB_SYNC_ALL);
494 /* See comment of filemap_write_and_wait() */490 /* See comment of filemap_write_and_wait() */
mm/memory.c+12−2
@@ -3404,8 +3404,18 @@ static int __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, · 3403 unmodified lines
3404 if (unlikely(pmd_none(*pmd)) &&3404 if (unlikely(pmd_none(*pmd)) &&
3405 unlikely(__pte_alloc(mm, vma, pmd, address)))3405 unlikely(__pte_alloc(mm, vma, pmd, address)))
3406 return VM_FAULT_OOM;3406 return VM_FAULT_OOM;
3407 /* if an huge pmd materialized from under us just retry later */3407 /*
3408 if (unlikely(pmd_trans_huge(*pmd) || pmd_devmap(*pmd)))3408 * If a huge pmd materialized under us just retry later. Use
3409 * pmd_trans_unstable() instead of pmd_trans_huge() to ensure the pmd
3410 * didn't become pmd_trans_huge under us and then back to pmd_none, as
3411 * a result of MADV_DONTNEED running immediately after a huge pmd fault
3412 * in a different thread of this mm, in turn leading to a misleading
3413 * pmd_trans_huge() retval. All we have to ensure is that it is a
3414 * regular pmd that we can walk with pte_offset_map() and we can do that
3415 * through an atomic read in C, which is what pmd_trans_unstable()
3416 * provides.
3417 */
3418 if (unlikely(pmd_trans_unstable(pmd) || pmd_devmap(*pmd)))
3409 return 0;3419 return 0;
3410 /*3420 /*
3411 * A regular pmd is established and it can't morph into a huge pmd3421 * A regular pmd is established and it can't morph into a huge pmd
mm/migrate.c+1−1
@@ -1582,7 +1582,7 @@ static struct page *alloc_misplaced_dst_page(struct page *page, · 1581 unmodified lines
1582 (GFP_HIGHUSER_MOVABLE |1582 (GFP_HIGHUSER_MOVABLE |
1583 __GFP_THISNODE | __GFP_NOMEMALLOC |1583 __GFP_THISNODE | __GFP_NOMEMALLOC |
1584 __GFP_NORETRY | __GFP_NOWARN) &1584 __GFP_NORETRY | __GFP_NOWARN) &
1585 ~(__GFP_IO | __GFP_FS), 0);1585 ~__GFP_RECLAIM, 0);
1586 1586
1587 return newpage;1587 return newpage;
1588}1588}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t