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 Morton)

Merge fixes from Andrew Morton:
"14 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
shmem: fix init_page_accessed use to stop !PageLRU bug
kernel/printk/printk.c: revert "printk: enable interrupts before calling console_trylock_for_printk()"
tools/testing/selftests/ipc/msgque.c: improve error handling when not running as root
fs/seq_file: fallback to vmalloc allocation
/proc/stat: convert to single_open_size()
hwpoison: fix the handling path of the victimized page frame that belong to non-LRU
mm:vmscan: update the trace-vmscan-postprocess.pl for event vmscan/mm_vmscan_lru_isolate
msync: fix incorrect fstart calculation
zram: revalidate disk after capacity change
tools: memory-hotplug fix unexpected operator error
tools: cpu-hotplug fix unexpected operator error
autofs4: fix false positive compile error
slub: fix off by one in number of slab tests
mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER

+89 -86
+2 -12
Documentation/trace/postprocess/trace-vmscan-postprocess.pl
··· 47 47 use constant HIGH_NR_SCANNED => 22; 48 48 use constant HIGH_NR_TAKEN => 23; 49 49 use constant HIGH_NR_RECLAIMED => 24; 50 - use constant HIGH_NR_CONTIG_DIRTY => 25; 51 50 52 51 my %perprocesspid; 53 52 my %perprocess; ··· 104 105 my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; 105 106 my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; 106 107 my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; 107 - my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) contig_taken=([0-9]*) contig_dirty=([0-9]*) contig_failed=([0-9]*)'; 108 + my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) file=([0-9]*)'; 108 109 my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; 109 110 my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; 110 111 my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; ··· 199 200 $regex_lru_isolate_default, 200 201 "isolate_mode", "order", 201 202 "nr_requested", "nr_scanned", "nr_taken", 202 - "contig_taken", "contig_dirty", "contig_failed"); 203 + "file"); 203 204 $regex_lru_shrink_inactive = generate_traceevent_regex( 204 205 "vmscan/mm_vmscan_lru_shrink_inactive", 205 206 $regex_lru_shrink_inactive_default, ··· 374 375 } 375 376 my $isolate_mode = $1; 376 377 my $nr_scanned = $4; 377 - my $nr_contig_dirty = $7; 378 378 379 379 # To closer match vmstat scanning statistics, only count isolate_both 380 380 # and isolate_inactive as scanning. isolate_active is rotation ··· 383 385 if ($isolate_mode != 2) { 384 386 $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; 385 387 } 386 - $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty; 387 388 } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { 388 389 $details = $6; 389 390 if ($details !~ /$regex_lru_shrink_inactive/o) { ··· 534 537 if ($count != 0) { 535 538 print "wakeup-$order=$count "; 536 539 } 537 - } 538 - } 539 - if ($stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}) { 540 - print " "; 541 - my $count = $stats{$process_pid}->{HIGH_NR_CONTIG_DIRTY}; 542 - if ($count != 0) { 543 - print "contig-dirty=$count "; 544 540 } 545 541 } 546 542
+4 -1
drivers/block/zram/zram_drv.c
··· 622 622 memset(&zram->stats, 0, sizeof(zram->stats)); 623 623 624 624 zram->disksize = 0; 625 - if (reset_capacity) 625 + if (reset_capacity) { 626 626 set_capacity(zram->disk, 0); 627 + revalidate_disk(zram->disk); 628 + } 627 629 up_write(&zram->init_lock); 628 630 } 629 631 ··· 666 664 zram->comp = comp; 667 665 zram->disksize = disksize; 668 666 set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT); 667 + revalidate_disk(zram->disk); 669 668 up_write(&zram->init_lock); 670 669 return len; 671 670
+1 -1
fs/autofs4/inode.c
··· 210 210 int pipefd; 211 211 struct autofs_sb_info *sbi; 212 212 struct autofs_info *ino; 213 - int pgrp; 213 + int pgrp = 0; 214 214 bool pgrp_set = false; 215 215 int ret = -EINVAL; 216 216
+2 -20
fs/proc/stat.c
··· 184 184 185 185 static int stat_open(struct inode *inode, struct file *file) 186 186 { 187 - size_t size = 1024 + 128 * num_possible_cpus(); 188 - char *buf; 189 - struct seq_file *m; 190 - int res; 187 + size_t size = 1024 + 128 * num_online_cpus(); 191 188 192 189 /* minimum size to display an interrupt count : 2 bytes */ 193 190 size += 2 * nr_irqs; 194 - 195 - /* don't ask for more than the kmalloc() max size */ 196 - if (size > KMALLOC_MAX_SIZE) 197 - size = KMALLOC_MAX_SIZE; 198 - buf = kmalloc(size, GFP_KERNEL); 199 - if (!buf) 200 - return -ENOMEM; 201 - 202 - res = single_open(file, show_stat, NULL); 203 - if (!res) { 204 - m = file->private_data; 205 - m->buf = buf; 206 - m->size = ksize(buf); 207 - } else 208 - kfree(buf); 209 - return res; 191 + return single_open_size(file, show_stat, NULL, size); 210 192 } 211 193 212 194 static const struct file_operations proc_stat_operations = {
+21 -9
fs/seq_file.c
··· 8 8 #include <linux/fs.h> 9 9 #include <linux/export.h> 10 10 #include <linux/seq_file.h> 11 + #include <linux/vmalloc.h> 11 12 #include <linux/slab.h> 12 13 #include <linux/cred.h> 14 + #include <linux/mm.h> 13 15 14 16 #include <asm/uaccess.h> 15 17 #include <asm/page.h> ··· 30 28 static void seq_set_overflow(struct seq_file *m) 31 29 { 32 30 m->count = m->size; 31 + } 32 + 33 + static void *seq_buf_alloc(unsigned long size) 34 + { 35 + void *buf; 36 + 37 + buf = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); 38 + if (!buf && size > PAGE_SIZE) 39 + buf = vmalloc(size); 40 + return buf; 33 41 } 34 42 35 43 /** ··· 108 96 return 0; 109 97 } 110 98 if (!m->buf) { 111 - m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); 99 + m->buf = seq_buf_alloc(m->size = PAGE_SIZE); 112 100 if (!m->buf) 113 101 return -ENOMEM; 114 102 } ··· 147 135 148 136 Eoverflow: 149 137 m->op->stop(m, p); 150 - kfree(m->buf); 138 + kvfree(m->buf); 151 139 m->count = 0; 152 - m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); 140 + m->buf = seq_buf_alloc(m->size <<= 1); 153 141 return !m->buf ? -ENOMEM : -EAGAIN; 154 142 } 155 143 ··· 204 192 205 193 /* grab buffer if we didn't have one */ 206 194 if (!m->buf) { 207 - m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL); 195 + m->buf = seq_buf_alloc(m->size = PAGE_SIZE); 208 196 if (!m->buf) 209 197 goto Enomem; 210 198 } ··· 244 232 if (m->count < m->size) 245 233 goto Fill; 246 234 m->op->stop(m, p); 247 - kfree(m->buf); 235 + kvfree(m->buf); 248 236 m->count = 0; 249 - m->buf = kmalloc(m->size <<= 1, GFP_KERNEL); 237 + m->buf = seq_buf_alloc(m->size <<= 1); 250 238 if (!m->buf) 251 239 goto Enomem; 252 240 m->version = 0; ··· 362 350 int seq_release(struct inode *inode, struct file *file) 363 351 { 364 352 struct seq_file *m = file->private_data; 365 - kfree(m->buf); 353 + kvfree(m->buf); 366 354 kfree(m); 367 355 return 0; 368 356 } ··· 617 605 int single_open_size(struct file *file, int (*show)(struct seq_file *, void *), 618 606 void *data, size_t size) 619 607 { 620 - char *buf = kmalloc(size, GFP_KERNEL); 608 + char *buf = seq_buf_alloc(size); 621 609 int ret; 622 610 if (!buf) 623 611 return -ENOMEM; 624 612 ret = single_open(file, show, data); 625 613 if (ret) { 626 - kfree(buf); 614 + kvfree(buf); 627 615 return ret; 628 616 } 629 617 ((struct seq_file *)file->private_data)->buf = buf;
+18 -26
kernel/printk/printk.c
··· 1416 1416 /* 1417 1417 * Can we actually use the console at this time on this cpu? 1418 1418 * 1419 - * Console drivers may assume that per-cpu resources have been allocated. So 1420 - * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't 1421 - * call them until this CPU is officially up. 1419 + * Console drivers may assume that per-cpu resources have 1420 + * been allocated. So unless they're explicitly marked as 1421 + * being able to cope (CON_ANYTIME) don't call them until 1422 + * this CPU is officially up. 1422 1423 */ 1423 1424 static inline int can_use_console(unsigned int cpu) 1424 1425 { ··· 1432 1431 * console_lock held, and 'console_locked' set) if it 1433 1432 * is successful, false otherwise. 1434 1433 */ 1435 - static int console_trylock_for_printk(void) 1434 + static int console_trylock_for_printk(unsigned int cpu) 1436 1435 { 1437 - unsigned int cpu = smp_processor_id(); 1438 - 1439 1436 if (!console_trylock()) 1440 1437 return 0; 1441 1438 /* ··· 1608 1609 */ 1609 1610 if (!oops_in_progress && !lockdep_recursing(current)) { 1610 1611 recursion_bug = 1; 1611 - local_irq_restore(flags); 1612 - return 0; 1612 + goto out_restore_irqs; 1613 1613 } 1614 1614 zap_locks(); 1615 1615 } ··· 1716 1718 1717 1719 logbuf_cpu = UINT_MAX; 1718 1720 raw_spin_unlock(&logbuf_lock); 1719 - lockdep_on(); 1720 - local_irq_restore(flags); 1721 1721 1722 1722 /* If called from the scheduler, we can not call up(). */ 1723 - if (in_sched) 1724 - return printed_len; 1723 + if (!in_sched) { 1724 + /* 1725 + * Try to acquire and then immediately release the console 1726 + * semaphore. The release will print out buffers and wake up 1727 + * /dev/kmsg and syslog() users. 1728 + */ 1729 + if (console_trylock_for_printk(this_cpu)) 1730 + console_unlock(); 1731 + } 1725 1732 1726 - /* 1727 - * Disable preemption to avoid being preempted while holding 1728 - * console_sem which would prevent anyone from printing to console 1729 - */ 1730 - preempt_disable(); 1731 - /* 1732 - * Try to acquire and then immediately release the console semaphore. 1733 - * The release will print out buffers and wake up /dev/kmsg and syslog() 1734 - * users. 1735 - */ 1736 - if (console_trylock_for_printk()) 1737 - console_unlock(); 1738 - preempt_enable(); 1739 - 1733 + lockdep_on(); 1734 + out_restore_irqs: 1735 + local_irq_restore(flags); 1740 1736 return printed_len; 1741 1737 } 1742 1738 EXPORT_SYMBOL(vprintk_emit);
+5 -4
mm/memory-failure.c
··· 895 895 struct page *hpage = *hpagep; 896 896 struct page *ppage; 897 897 898 - if (PageReserved(p) || PageSlab(p)) 898 + if (PageReserved(p) || PageSlab(p) || !PageLRU(p)) 899 899 return SWAP_SUCCESS; 900 900 901 901 /* ··· 1159 1159 action_result(pfn, "free buddy, 2nd try", DELAYED); 1160 1160 return 0; 1161 1161 } 1162 - action_result(pfn, "non LRU", IGNORED); 1163 - put_page(p); 1164 - return -EBUSY; 1165 1162 } 1166 1163 } 1167 1164 ··· 1190 1193 put_page(hpage); 1191 1194 return 0; 1192 1195 } 1196 + 1197 + if (!PageHuge(p) && !PageTransTail(p) && !PageLRU(p)) 1198 + goto identify_page_state; 1193 1199 1194 1200 /* 1195 1201 * For error on the tail page, we should set PG_hwpoison ··· 1243 1243 goto out; 1244 1244 } 1245 1245 1246 + identify_page_state: 1246 1247 res = -EBUSY; 1247 1248 /* 1248 1249 * The first check uses the current page flags which may not have any
+2 -1
mm/msync.c
··· 78 78 goto out_unlock; 79 79 } 80 80 file = vma->vm_file; 81 - fstart = start + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 81 + fstart = (start - vma->vm_start) + 82 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 82 83 fend = fstart + (min(end, vma->vm_end) - start) - 1; 83 84 start = vma->vm_end; 84 85 if ((flags & MS_SYNC) && file &&
+14 -2
mm/page_alloc.c
··· 816 816 set_page_count(p, 0); 817 817 } while (++p, --i); 818 818 819 - set_page_refcounted(page); 820 819 set_pageblock_migratetype(page, MIGRATE_CMA); 821 - __free_pages(page, pageblock_order); 820 + 821 + if (pageblock_order >= MAX_ORDER) { 822 + i = pageblock_nr_pages; 823 + p = page; 824 + do { 825 + set_page_refcounted(p); 826 + __free_pages(p, MAX_ORDER - 1); 827 + p += MAX_ORDER_NR_PAGES; 828 + } while (i -= MAX_ORDER_NR_PAGES); 829 + } else { 830 + set_page_refcounted(page); 831 + __free_pages(page, pageblock_order); 832 + } 833 + 822 834 adjust_managed_page_count(page, pageblock_nr_pages); 823 835 } 824 836 #endif
+10 -5
mm/shmem.c
··· 1029 1029 goto failed; 1030 1030 } 1031 1031 1032 + if (page && sgp == SGP_WRITE) 1033 + mark_page_accessed(page); 1034 + 1032 1035 /* fallocated page? */ 1033 1036 if (page && !PageUptodate(page)) { 1034 1037 if (sgp != SGP_READ) ··· 1113 1110 shmem_recalc_inode(inode); 1114 1111 spin_unlock(&info->lock); 1115 1112 1113 + if (sgp == SGP_WRITE) 1114 + mark_page_accessed(page); 1115 + 1116 1116 delete_from_swap_cache(page); 1117 1117 set_page_dirty(page); 1118 1118 swap_free(swap); ··· 1142 1136 1143 1137 __SetPageSwapBacked(page); 1144 1138 __set_page_locked(page); 1139 + if (sgp == SGP_WRITE) 1140 + init_page_accessed(page); 1141 + 1145 1142 error = mem_cgroup_charge_file(page, current->mm, 1146 1143 gfp & GFP_RECLAIM_MASK); 1147 1144 if (error) ··· 1421 1412 loff_t pos, unsigned len, unsigned flags, 1422 1413 struct page **pagep, void **fsdata) 1423 1414 { 1424 - int ret; 1425 1415 struct inode *inode = mapping->host; 1426 1416 pgoff_t index = pos >> PAGE_CACHE_SHIFT; 1427 - ret = shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); 1428 - if (ret == 0 && *pagep) 1429 - init_page_accessed(*pagep); 1430 - return ret; 1417 + return shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); 1431 1418 } 1432 1419 1433 1420 static int
+3 -3
mm/slub.c
··· 1881 1881 1882 1882 new.frozen = 0; 1883 1883 1884 - if (!new.inuse && n->nr_partial > s->min_partial) 1884 + if (!new.inuse && n->nr_partial >= s->min_partial) 1885 1885 m = M_FREE; 1886 1886 else if (new.freelist) { 1887 1887 m = M_PARTIAL; ··· 1992 1992 new.freelist, new.counters, 1993 1993 "unfreezing slab")); 1994 1994 1995 - if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) { 1995 + if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) { 1996 1996 page->next = discard_page; 1997 1997 discard_page = page; 1998 1998 } else { ··· 2620 2620 return; 2621 2621 } 2622 2622 2623 - if (unlikely(!new.inuse && n->nr_partial > s->min_partial)) 2623 + if (unlikely(!new.inuse && n->nr_partial >= s->min_partial)) 2624 2624 goto slab_empty; 2625 2625 2626 2626 /*
+1 -1
tools/testing/selftests/cpu-hotplug/Makefile
··· 1 1 all: 2 2 3 3 run_tests: 4 - @/bin/sh ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" 4 + @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" 5 5 6 6 clean:
+5
tools/testing/selftests/ipc/msgque.c
··· 193 193 int msg, pid, err; 194 194 struct msgque_data msgque; 195 195 196 + if (getuid() != 0) { 197 + printf("Please run the test as root - Exiting.\n"); 198 + exit(1); 199 + } 200 + 196 201 msgque.key = ftok(argv[0], 822155650); 197 202 if (msgque.key == -1) { 198 203 printf("Can't make key\n");
+1 -1
tools/testing/selftests/memory-hotplug/Makefile
··· 1 1 all: 2 2 3 3 run_tests: 4 - @/bin/sh ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" 4 + @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" 5 5 6 6 clean: