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:
"16 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
coredump: fix race condition between mmget_not_zero()/get_task_mm() and core dumping
mm/kmemleak.c: fix unused-function warning
init: initialize jump labels before command line option parsing
kernel/watchdog_hld.c: hard lockup message should end with a newline
kcov: improve CONFIG_ARCH_HAS_KCOV help text
mm: fix inactive list balancing between NUMA nodes and cgroups
mm/hotplug: treat CMA pages as unmovable
proc: fixup proc-pid-vm test
proc: fix map_files test on F29
mm/vmstat.c: fix /proc/vmstat format for CONFIG_DEBUG_TLBFLUSH=y CONFIG_SMP=n
mm/memory_hotplug: do not unlock after failing to take the device_hotplug_lock
mm: swapoff: shmem_unuse() stop eviction without igrab()
mm: swapoff: take notice of completion sooner
mm: swapoff: remove too limiting SWAP_UNUSE_MAX_TRIES
mm: swapoff: shmem_find_swap_entries() filter out other types
slab: store tagged freelist for off-slab slabmgmt

+151 -104
+1 -1
drivers/base/memory.c
··· 506 506 507 507 ret = lock_device_hotplug_sysfs(); 508 508 if (ret) 509 - goto out; 509 + return ret; 510 510 511 511 nid = memory_add_physaddr_to_nid(phys_addr); 512 512 ret = __add_memory(nid, phys_addr,
+3
drivers/infiniband/core/uverbs_main.c
··· 993 993 * will only be one mm, so no big deal. 994 994 */ 995 995 down_write(&mm->mmap_sem); 996 + if (!mmget_still_valid(mm)) 997 + goto skip_mm; 996 998 mutex_lock(&ufile->umap_lock); 997 999 list_for_each_entry_safe (priv, next_priv, &ufile->umaps, 998 1000 list) { ··· 1009 1007 vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); 1010 1008 } 1011 1009 mutex_unlock(&ufile->umap_lock); 1010 + skip_mm: 1012 1011 up_write(&mm->mmap_sem); 1013 1012 mmput(mm); 1014 1013 }
+18
fs/proc/task_mmu.c
··· 1143 1143 count = -EINTR; 1144 1144 goto out_mm; 1145 1145 } 1146 + /* 1147 + * Avoid to modify vma->vm_flags 1148 + * without locked ops while the 1149 + * coredump reads the vm_flags. 1150 + */ 1151 + if (!mmget_still_valid(mm)) { 1152 + /* 1153 + * Silently return "count" 1154 + * like if get_task_mm() 1155 + * failed. FIXME: should this 1156 + * function have returned 1157 + * -ESRCH if get_task_mm() 1158 + * failed like if 1159 + * get_proc_task() fails? 1160 + */ 1161 + up_write(&mm->mmap_sem); 1162 + goto out_mm; 1163 + } 1146 1164 for (vma = mm->mmap; vma; vma = vma->vm_next) { 1147 1165 vma->vm_flags &= ~VM_SOFTDIRTY; 1148 1166 vma_set_page_prot(vma);
+9
fs/userfaultfd.c
··· 629 629 630 630 /* the various vma->vm_userfaultfd_ctx still points to it */ 631 631 down_write(&mm->mmap_sem); 632 + /* no task can run (and in turn coredump) yet */ 633 + VM_WARN_ON(!mmget_still_valid(mm)); 632 634 for (vma = mm->mmap; vma; vma = vma->vm_next) 633 635 if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) { 634 636 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; ··· 885 883 * taking the mmap_sem for writing. 886 884 */ 887 885 down_write(&mm->mmap_sem); 886 + if (!mmget_still_valid(mm)) 887 + goto skip_mm; 888 888 prev = NULL; 889 889 for (vma = mm->mmap; vma; vma = vma->vm_next) { 890 890 cond_resched(); ··· 909 905 vma->vm_flags = new_flags; 910 906 vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; 911 907 } 908 + skip_mm: 912 909 up_write(&mm->mmap_sem); 913 910 mmput(mm); 914 911 wakeup: ··· 1338 1333 goto out; 1339 1334 1340 1335 down_write(&mm->mmap_sem); 1336 + if (!mmget_still_valid(mm)) 1337 + goto out_unlock; 1341 1338 vma = find_vma_prev(mm, start, &prev); 1342 1339 if (!vma) 1343 1340 goto out_unlock; ··· 1527 1520 goto out; 1528 1521 1529 1522 down_write(&mm->mmap_sem); 1523 + if (!mmget_still_valid(mm)) 1524 + goto out_unlock; 1530 1525 vma = find_vma_prev(mm, start, &prev); 1531 1526 if (!vma) 1532 1527 goto out_unlock;
+21
include/linux/sched/mm.h
··· 49 49 __mmdrop(mm); 50 50 } 51 51 52 + /* 53 + * This has to be called after a get_task_mm()/mmget_not_zero() 54 + * followed by taking the mmap_sem for writing before modifying the 55 + * vmas or anything the coredump pretends not to change from under it. 56 + * 57 + * NOTE: find_extend_vma() called from GUP context is the only place 58 + * that can modify the "mm" (notably the vm_start/end) under mmap_sem 59 + * for reading and outside the context of the process, so it is also 60 + * the only case that holds the mmap_sem for reading that must call 61 + * this function. Generally if the mmap_sem is hold for reading 62 + * there's no need of this check after get_task_mm()/mmget_not_zero(). 63 + * 64 + * This function can be obsoleted and the check can be removed, after 65 + * the coredump code will hold the mmap_sem for writing before 66 + * invoking the ->core_dump methods. 67 + */ 68 + static inline bool mmget_still_valid(struct mm_struct *mm) 69 + { 70 + return likely(!mm->core_state); 71 + } 72 + 52 73 /** 53 74 * mmget() - Pin the address space associated with a &struct mm_struct. 54 75 * @mm: The address space to pin.
+1
include/linux/shmem_fs.h
··· 21 21 struct list_head swaplist; /* chain of maybes on swap */ 22 22 struct shared_policy policy; /* NUMA memory alloc policy */ 23 23 struct simple_xattrs xattrs; /* list of xattrs */ 24 + atomic_t stop_eviction; /* hold when working on inode */ 24 25 struct inode vfs_inode; 25 26 }; 26 27
+2 -2
init/main.c
··· 582 582 page_alloc_init(); 583 583 584 584 pr_notice("Kernel command line: %s\n", boot_command_line); 585 + /* parameters may set static keys */ 586 + jump_label_init(); 585 587 parse_early_param(); 586 588 after_dashes = parse_args("Booting kernel", 587 589 static_command_line, __start___param, ··· 592 590 if (!IS_ERR_OR_NULL(after_dashes)) 593 591 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, 594 592 NULL, set_init_arg); 595 - 596 - jump_label_init(); 597 593 598 594 /* 599 595 * These use large bootmem allocations and must precede
+2 -1
kernel/watchdog_hld.c
··· 135 135 if (__this_cpu_read(hard_watchdog_warn) == true) 136 136 return; 137 137 138 - pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu); 138 + pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", 139 + this_cpu); 139 140 print_modules(); 140 141 print_irqtrace_events(current); 141 142 if (regs)
+3 -3
lib/Kconfig.debug
··· 753 753 config ARCH_HAS_KCOV 754 754 bool 755 755 help 756 - KCOV does not have any arch-specific code, but currently it is enabled 757 - only for x86_64. KCOV requires testing on other archs, and most likely 758 - disabling of instrumentation for some early boot code. 756 + An architecture should select this when it can successfully 757 + build and run with CONFIG_KCOV. This typically requires 758 + disabling instrumentation for some early boot code. 759 759 760 760 config CC_HAS_SANCOV_TRACE_PC 761 761 def_bool $(cc-option,-fsanitize-coverage=trace-pc)
+2
mm/kmemleak.c
··· 1401 1401 /* 1402 1402 * Scan a large memory block in MAX_SCAN_SIZE chunks to reduce the latency. 1403 1403 */ 1404 + #ifdef CONFIG_SMP 1404 1405 static void scan_large_block(void *start, void *end) 1405 1406 { 1406 1407 void *next; ··· 1413 1412 cond_resched(); 1414 1413 } 1415 1414 } 1415 + #endif 1416 1416 1417 1417 /* 1418 1418 * Scan a memory block corresponding to a kmemleak_object. A condition is
+6 -1
mm/mmap.c
··· 45 45 #include <linux/moduleparam.h> 46 46 #include <linux/pkeys.h> 47 47 #include <linux/oom.h> 48 + #include <linux/sched/mm.h> 48 49 49 50 #include <linux/uaccess.h> 50 51 #include <asm/cacheflush.h> ··· 2526 2525 vma = find_vma_prev(mm, addr, &prev); 2527 2526 if (vma && (vma->vm_start <= addr)) 2528 2527 return vma; 2529 - if (!prev || expand_stack(prev, addr)) 2528 + /* don't alter vm_end if the coredump is running */ 2529 + if (!prev || !mmget_still_valid(mm) || expand_stack(prev, addr)) 2530 2530 return NULL; 2531 2531 if (prev->vm_flags & VM_LOCKED) 2532 2532 populate_vma_page_range(prev, addr, prev->vm_end, NULL); ··· 2552 2550 if (vma->vm_start <= addr) 2553 2551 return vma; 2554 2552 if (!(vma->vm_flags & VM_GROWSDOWN)) 2553 + return NULL; 2554 + /* don't alter vm_start if the coredump is running */ 2555 + if (!mmget_still_valid(mm)) 2555 2556 return NULL; 2556 2557 start = vma->vm_start; 2557 2558 if (expand_stack(vma, addr))
+18 -12
mm/page_alloc.c
··· 8005 8005 bool has_unmovable_pages(struct zone *zone, struct page *page, int count, 8006 8006 int migratetype, int flags) 8007 8007 { 8008 - unsigned long pfn, iter, found; 8008 + unsigned long found; 8009 + unsigned long iter = 0; 8010 + unsigned long pfn = page_to_pfn(page); 8011 + const char *reason = "unmovable page"; 8009 8012 8010 8013 /* 8011 8014 * TODO we could make this much more efficient by not checking every ··· 8018 8015 * can still lead to having bootmem allocations in zone_movable. 8019 8016 */ 8020 8017 8021 - /* 8022 - * CMA allocations (alloc_contig_range) really need to mark isolate 8023 - * CMA pageblocks even when they are not movable in fact so consider 8024 - * them movable here. 8025 - */ 8026 - if (is_migrate_cma(migratetype) && 8027 - is_migrate_cma(get_pageblock_migratetype(page))) 8028 - return false; 8018 + if (is_migrate_cma_page(page)) { 8019 + /* 8020 + * CMA allocations (alloc_contig_range) really need to mark 8021 + * isolate CMA pageblocks even when they are not movable in fact 8022 + * so consider them movable here. 8023 + */ 8024 + if (is_migrate_cma(migratetype)) 8025 + return false; 8029 8026 8030 - pfn = page_to_pfn(page); 8031 - for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { 8027 + reason = "CMA page"; 8028 + goto unmovable; 8029 + } 8030 + 8031 + for (found = 0; iter < pageblock_nr_pages; iter++) { 8032 8032 unsigned long check = pfn + iter; 8033 8033 8034 8034 if (!pfn_valid_within(check)) ··· 8111 8105 unmovable: 8112 8106 WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE); 8113 8107 if (flags & REPORT_FAILURE) 8114 - dump_page(pfn_to_page(pfn+iter), "unmovable page"); 8108 + dump_page(pfn_to_page(pfn + iter), reason); 8115 8109 return true; 8116 8110 } 8117 8111
+27 -31
mm/shmem.c
··· 1081 1081 } 1082 1082 spin_unlock(&sbinfo->shrinklist_lock); 1083 1083 } 1084 - if (!list_empty(&info->swaplist)) { 1084 + while (!list_empty(&info->swaplist)) { 1085 + /* Wait while shmem_unuse() is scanning this inode... */ 1086 + wait_var_event(&info->stop_eviction, 1087 + !atomic_read(&info->stop_eviction)); 1085 1088 mutex_lock(&shmem_swaplist_mutex); 1086 - list_del_init(&info->swaplist); 1089 + /* ...but beware of the race if we peeked too early */ 1090 + if (!atomic_read(&info->stop_eviction)) 1091 + list_del_init(&info->swaplist); 1087 1092 mutex_unlock(&shmem_swaplist_mutex); 1088 1093 } 1089 1094 } ··· 1104 1099 static int shmem_find_swap_entries(struct address_space *mapping, 1105 1100 pgoff_t start, unsigned int nr_entries, 1106 1101 struct page **entries, pgoff_t *indices, 1107 - bool frontswap) 1102 + unsigned int type, bool frontswap) 1108 1103 { 1109 1104 XA_STATE(xas, &mapping->i_pages, start); 1110 1105 struct page *page; 1106 + swp_entry_t entry; 1111 1107 unsigned int ret = 0; 1112 1108 1113 1109 if (!nr_entries) ··· 1122 1116 if (!xa_is_value(page)) 1123 1117 continue; 1124 1118 1125 - if (frontswap) { 1126 - swp_entry_t entry = radix_to_swp_entry(page); 1127 - 1128 - if (!frontswap_test(swap_info[swp_type(entry)], 1129 - swp_offset(entry))) 1130 - continue; 1131 - } 1119 + entry = radix_to_swp_entry(page); 1120 + if (swp_type(entry) != type) 1121 + continue; 1122 + if (frontswap && 1123 + !frontswap_test(swap_info[type], swp_offset(entry))) 1124 + continue; 1132 1125 1133 1126 indices[ret] = xas.xa_index; 1134 1127 entries[ret] = page; ··· 1199 1194 1200 1195 pvec.nr = shmem_find_swap_entries(mapping, start, nr_entries, 1201 1196 pvec.pages, indices, 1202 - frontswap); 1197 + type, frontswap); 1203 1198 if (pvec.nr == 0) { 1204 1199 ret = 0; 1205 1200 break; ··· 1232 1227 unsigned long *fs_pages_to_unuse) 1233 1228 { 1234 1229 struct shmem_inode_info *info, *next; 1235 - struct inode *inode; 1236 - struct inode *prev_inode = NULL; 1237 1230 int error = 0; 1238 1231 1239 1232 if (list_empty(&shmem_swaplist)) 1240 1233 return 0; 1241 1234 1242 1235 mutex_lock(&shmem_swaplist_mutex); 1243 - 1244 - /* 1245 - * The extra refcount on the inode is necessary to safely dereference 1246 - * p->next after re-acquiring the lock. New shmem inodes with swap 1247 - * get added to the end of the list and we will scan them all. 1248 - */ 1249 1236 list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) { 1250 1237 if (!info->swapped) { 1251 1238 list_del_init(&info->swaplist); 1252 1239 continue; 1253 1240 } 1254 - 1255 - inode = igrab(&info->vfs_inode); 1256 - if (!inode) 1257 - continue; 1258 - 1241 + /* 1242 + * Drop the swaplist mutex while searching the inode for swap; 1243 + * but before doing so, make sure shmem_evict_inode() will not 1244 + * remove placeholder inode from swaplist, nor let it be freed 1245 + * (igrab() would protect from unlink, but not from unmount). 1246 + */ 1247 + atomic_inc(&info->stop_eviction); 1259 1248 mutex_unlock(&shmem_swaplist_mutex); 1260 - if (prev_inode) 1261 - iput(prev_inode); 1262 - prev_inode = inode; 1263 1249 1264 - error = shmem_unuse_inode(inode, type, frontswap, 1250 + error = shmem_unuse_inode(&info->vfs_inode, type, frontswap, 1265 1251 fs_pages_to_unuse); 1266 1252 cond_resched(); 1267 1253 ··· 1260 1264 next = list_next_entry(info, swaplist); 1261 1265 if (!info->swapped) 1262 1266 list_del_init(&info->swaplist); 1267 + if (atomic_dec_and_test(&info->stop_eviction)) 1268 + wake_up_var(&info->stop_eviction); 1263 1269 if (error) 1264 1270 break; 1265 1271 } 1266 1272 mutex_unlock(&shmem_swaplist_mutex); 1267 - 1268 - if (prev_inode) 1269 - iput(prev_inode); 1270 1273 1271 1274 return error; 1272 1275 } ··· 2233 2238 info = SHMEM_I(inode); 2234 2239 memset(info, 0, (char *)inode - (char *)info); 2235 2240 spin_lock_init(&info->lock); 2241 + atomic_set(&info->stop_eviction, 0); 2236 2242 info->seals = F_SEAL_SEAL; 2237 2243 info->flags = flags & VM_NORESERVE; 2238 2244 INIT_LIST_HEAD(&info->shrinklist);
-1
mm/slab.c
··· 2374 2374 /* Slab management obj is off-slab. */ 2375 2375 freelist = kmem_cache_alloc_node(cachep->freelist_cache, 2376 2376 local_flags, nodeid); 2377 - freelist = kasan_reset_tag(freelist); 2378 2377 if (!freelist) 2379 2378 return NULL; 2380 2379 } else {
+17 -15
mm/swapfile.c
··· 2023 2023 * If the boolean frontswap is true, only unuse pages_to_unuse pages; 2024 2024 * pages_to_unuse==0 means all pages; ignored if frontswap is false 2025 2025 */ 2026 - #define SWAP_UNUSE_MAX_TRIES 3 2027 2026 int try_to_unuse(unsigned int type, bool frontswap, 2028 2027 unsigned long pages_to_unuse) 2029 2028 { ··· 2034 2035 struct page *page; 2035 2036 swp_entry_t entry; 2036 2037 unsigned int i; 2037 - int retries = 0; 2038 2038 2039 2039 if (!si->inuse_pages) 2040 2040 return 0; ··· 2051 2053 2052 2054 spin_lock(&mmlist_lock); 2053 2055 p = &init_mm.mmlist; 2054 - while ((p = p->next) != &init_mm.mmlist) { 2055 - if (signal_pending(current)) { 2056 - retval = -EINTR; 2057 - break; 2058 - } 2056 + while (si->inuse_pages && 2057 + !signal_pending(current) && 2058 + (p = p->next) != &init_mm.mmlist) { 2059 2059 2060 2060 mm = list_entry(p, struct mm_struct, mmlist); 2061 2061 if (!mmget_not_zero(mm)) ··· 2080 2084 mmput(prev_mm); 2081 2085 2082 2086 i = 0; 2083 - while ((i = find_next_to_unuse(si, i, frontswap)) != 0) { 2087 + while (si->inuse_pages && 2088 + !signal_pending(current) && 2089 + (i = find_next_to_unuse(si, i, frontswap)) != 0) { 2084 2090 2085 2091 entry = swp_entry(type, i); 2086 2092 page = find_get_page(swap_address_space(entry), i); ··· 2115 2117 * If yes, we would need to do retry the unuse logic again. 2116 2118 * Under global memory pressure, swap entries can be reinserted back 2117 2119 * into process space after the mmlist loop above passes over them. 2118 - * Its not worth continuosuly retrying to unuse the swap in this case. 2119 - * So we try SWAP_UNUSE_MAX_TRIES times. 2120 + * 2121 + * Limit the number of retries? No: when mmget_not_zero() above fails, 2122 + * that mm is likely to be freeing swap from exit_mmap(), which proceeds 2123 + * at its own independent pace; and even shmem_writepage() could have 2124 + * been preempted after get_swap_page(), temporarily hiding that swap. 2125 + * It's easy and robust (though cpu-intensive) just to keep retrying. 2120 2126 */ 2121 - if (++retries >= SWAP_UNUSE_MAX_TRIES) 2122 - retval = -EBUSY; 2123 - else if (si->inuse_pages) 2124 - goto retry; 2125 - 2127 + if (si->inuse_pages) { 2128 + if (!signal_pending(current)) 2129 + goto retry; 2130 + retval = -EINTR; 2131 + } 2126 2132 out: 2127 2133 return (retval == FRONTSWAP_PAGES_UNUSED) ? 0 : retval; 2128 2134 }
+9 -20
mm/vmscan.c
··· 2176 2176 * 10TB 320 32GB 2177 2177 */ 2178 2178 static bool inactive_list_is_low(struct lruvec *lruvec, bool file, 2179 - struct mem_cgroup *memcg, 2180 2179 struct scan_control *sc, bool actual_reclaim) 2181 2180 { 2182 2181 enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE; ··· 2196 2197 inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx); 2197 2198 active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx); 2198 2199 2199 - if (memcg) 2200 - refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE); 2201 - else 2202 - refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE); 2203 - 2204 2200 /* 2205 2201 * When refaults are being observed, it means a new workingset 2206 2202 * is being established. Disable active list protection to get 2207 2203 * rid of the stale workingset quickly. 2208 2204 */ 2205 + refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE); 2209 2206 if (file && actual_reclaim && lruvec->refaults != refaults) { 2210 2207 inactive_ratio = 0; 2211 2208 } else { ··· 2222 2227 } 2223 2228 2224 2229 static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, 2225 - struct lruvec *lruvec, struct mem_cgroup *memcg, 2226 - struct scan_control *sc) 2230 + struct lruvec *lruvec, struct scan_control *sc) 2227 2231 { 2228 2232 if (is_active_lru(lru)) { 2229 - if (inactive_list_is_low(lruvec, is_file_lru(lru), 2230 - memcg, sc, true)) 2233 + if (inactive_list_is_low(lruvec, is_file_lru(lru), sc, true)) 2231 2234 shrink_active_list(nr_to_scan, lruvec, sc, lru); 2232 2235 return 0; 2233 2236 } ··· 2325 2332 * anonymous pages on the LRU in eligible zones. 2326 2333 * Otherwise, the small LRU gets thrashed. 2327 2334 */ 2328 - if (!inactive_list_is_low(lruvec, false, memcg, sc, false) && 2335 + if (!inactive_list_is_low(lruvec, false, sc, false) && 2329 2336 lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, sc->reclaim_idx) 2330 2337 >> sc->priority) { 2331 2338 scan_balance = SCAN_ANON; ··· 2343 2350 * lruvec even if it has plenty of old anonymous pages unless the 2344 2351 * system is under heavy pressure. 2345 2352 */ 2346 - if (!inactive_list_is_low(lruvec, true, memcg, sc, false) && 2353 + if (!inactive_list_is_low(lruvec, true, sc, false) && 2347 2354 lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> sc->priority) { 2348 2355 scan_balance = SCAN_FILE; 2349 2356 goto out; ··· 2496 2503 nr[lru] -= nr_to_scan; 2497 2504 2498 2505 nr_reclaimed += shrink_list(lru, nr_to_scan, 2499 - lruvec, memcg, sc); 2506 + lruvec, sc); 2500 2507 } 2501 2508 } 2502 2509 ··· 2563 2570 * Even if we did not try to evict anon pages at all, we want to 2564 2571 * rebalance the anon lru active/inactive ratio. 2565 2572 */ 2566 - if (inactive_list_is_low(lruvec, false, memcg, sc, true)) 2573 + if (inactive_list_is_low(lruvec, false, sc, true)) 2567 2574 shrink_active_list(SWAP_CLUSTER_MAX, lruvec, 2568 2575 sc, LRU_ACTIVE_ANON); 2569 2576 } ··· 2962 2969 unsigned long refaults; 2963 2970 struct lruvec *lruvec; 2964 2971 2965 - if (memcg) 2966 - refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE); 2967 - else 2968 - refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE); 2969 - 2970 2972 lruvec = mem_cgroup_lruvec(pgdat, memcg); 2973 + refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE); 2971 2974 lruvec->refaults = refaults; 2972 2975 } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL))); 2973 2976 } ··· 3328 3339 do { 3329 3340 struct lruvec *lruvec = mem_cgroup_lruvec(pgdat, memcg); 3330 3341 3331 - if (inactive_list_is_low(lruvec, false, memcg, sc, true)) 3342 + if (inactive_list_is_low(lruvec, false, sc, true)) 3332 3343 shrink_active_list(SWAP_CLUSTER_MAX, lruvec, 3333 3344 sc, LRU_ACTIVE_ANON); 3334 3345
-5
mm/vmstat.c
··· 1274 1274 #endif 1275 1275 #endif /* CONFIG_MEMORY_BALLOON */ 1276 1276 #ifdef CONFIG_DEBUG_TLBFLUSH 1277 - #ifdef CONFIG_SMP 1278 1277 "nr_tlb_remote_flush", 1279 1278 "nr_tlb_remote_flush_received", 1280 - #else 1281 - "", /* nr_tlb_remote_flush */ 1282 - "", /* nr_tlb_remote_flush_received */ 1283 - #endif /* CONFIG_SMP */ 1284 1279 "nr_tlb_local_flush_all", 1285 1280 "nr_tlb_local_flush_one", 1286 1281 #endif /* CONFIG_DEBUG_TLBFLUSH */
+2 -2
tools/testing/selftests/proc/proc-pid-vm.c
··· 187 187 ph.p_offset = 0; 188 188 ph.p_vaddr = VADDR; 189 189 ph.p_paddr = 0; 190 - ph.p_filesz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + sizeof(payload); 191 - ph.p_memsz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + sizeof(payload); 190 + ph.p_filesz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + len; 191 + ph.p_memsz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + len; 192 192 ph.p_align = 4096; 193 193 194 194 fd = openat(AT_FDCWD, "/tmp", O_WRONLY|O_EXCL|O_TMPFILE, 0700);
+10 -10
tools/testing/selftests/proc/proc-self-map-files-002.c
··· 46 46 47 47 int main(void) 48 48 { 49 - const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE); 50 - #ifdef __arm__ 51 - unsigned long va = 2 * PAGE_SIZE; 52 - #else 53 - unsigned long va = 0; 54 - #endif 49 + const int PAGE_SIZE = sysconf(_SC_PAGESIZE); 50 + const unsigned long va_max = 1UL << 32; 51 + unsigned long va; 55 52 void *p; 56 53 int fd; 57 54 unsigned long a, b; ··· 57 60 if (fd == -1) 58 61 return 1; 59 62 60 - p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); 61 - if (p == MAP_FAILED) { 62 - if (errno == EPERM) 63 - return 4; 63 + for (va = 0; va < va_max; va += PAGE_SIZE) { 64 + p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); 65 + if (p == (void *)va) 66 + break; 67 + } 68 + if (va == va_max) { 69 + fprintf(stderr, "error: mmap doesn't like you\n"); 64 70 return 1; 65 71 } 66 72