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:
"Rather a lot of fixes, almost all affecting mm/"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (26 commits)
scripts/gdb: fix debugging modules on s390
kernel/events/uprobes.c: only do FOLL_SPLIT_PMD for uprobe register
mm/thp: allow dropping THP from page cache
mm/vmscan.c: support removing arbitrary sized pages from mapping
mm/thp: fix node page state in split_huge_page_to_list()
proc/meminfo: fix output alignment
mm/init-mm.c: include <linux/mman.h> for vm_committed_as_batch
mm/filemap.c: include <linux/ramfs.h> for generic_file_vm_ops definition
mm: include <linux/huge_mm.h> for is_vma_temporary_stack
zram: fix race between backing_dev_show and backing_dev_store
mm/memcontrol: update lruvec counters in mem_cgroup_move_account
ocfs2: fix panic due to ocfs2_wq is null
hugetlbfs: don't access uninitialized memmaps in pfn_range_valid_gigantic()
mm: memblock: do not enforce current limit for memblock_phys* family
mm: memcg: get number of pages on the LRU list in memcgroup base on lru_zone_size
mm/gup: fix a misnamed "write" argument, and a related bug
mm/gup_benchmark: add a missing "w" to getopt string
ocfs2: fix error handling in ocfs2_setattr()
mm: memcg/slab: fix panic in __free_slab() caused by premature memcg pointer release
mm/memunmap: don't access uninitialized memmap in memunmap_pages()
...

+166 -140
+3
drivers/base/memory.c
··· 540 540 pfn >>= PAGE_SHIFT; 541 541 if (!pfn_valid(pfn)) 542 542 return -ENXIO; 543 + /* Only online pages can be soft-offlined (esp., not ZONE_DEVICE). */ 544 + if (!pfn_to_online_page(pfn)) 545 + return -EIO; 543 546 ret = soft_offline_page(pfn_to_page(pfn), 0); 544 547 return ret == 0 ? count : ret; 545 548 }
+3 -2
drivers/block/zram/zram_drv.c
··· 413 413 static ssize_t backing_dev_show(struct device *dev, 414 414 struct device_attribute *attr, char *buf) 415 415 { 416 + struct file *file; 416 417 struct zram *zram = dev_to_zram(dev); 417 - struct file *file = zram->backing_dev; 418 418 char *p; 419 419 ssize_t ret; 420 420 421 421 down_read(&zram->init_lock); 422 - if (!zram->backing_dev) { 422 + file = zram->backing_dev; 423 + if (!file) { 423 424 memcpy(buf, "none\n", 5); 424 425 up_read(&zram->init_lock); 425 426 return 5;
+2
fs/ocfs2/file.c
··· 1230 1230 transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid)); 1231 1231 if (IS_ERR(transfer_to[USRQUOTA])) { 1232 1232 status = PTR_ERR(transfer_to[USRQUOTA]); 1233 + transfer_to[USRQUOTA] = NULL; 1233 1234 goto bail_unlock; 1234 1235 } 1235 1236 } ··· 1240 1239 transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid)); 1241 1240 if (IS_ERR(transfer_to[GRPQUOTA])) { 1242 1241 status = PTR_ERR(transfer_to[GRPQUOTA]); 1242 + transfer_to[GRPQUOTA] = NULL; 1243 1243 goto bail_unlock; 1244 1244 } 1245 1245 }
+2 -1
fs/ocfs2/journal.c
··· 217 217 /* At this point, we know that no more recovery threads can be 218 218 * launched, so wait for any recovery completion work to 219 219 * complete. */ 220 - flush_workqueue(osb->ocfs2_wq); 220 + if (osb->ocfs2_wq) 221 + flush_workqueue(osb->ocfs2_wq); 221 222 222 223 /* 223 224 * Now that recovery is shut down, and the osb is about to be
+2 -1
fs/ocfs2/localalloc.c
··· 377 377 struct ocfs2_dinode *alloc = NULL; 378 378 379 379 cancel_delayed_work(&osb->la_enable_wq); 380 - flush_workqueue(osb->ocfs2_wq); 380 + if (osb->ocfs2_wq) 381 + flush_workqueue(osb->ocfs2_wq); 381 382 382 383 if (osb->local_alloc_state == OCFS2_LA_UNUSED) 383 384 goto out;
+2 -2
fs/proc/meminfo.c
··· 132 132 global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR); 133 133 show_val_kb(m, "ShmemPmdMapped: ", 134 134 global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR); 135 - show_val_kb(m, "FileHugePages: ", 135 + show_val_kb(m, "FileHugePages: ", 136 136 global_node_page_state(NR_FILE_THPS) * HPAGE_PMD_NR); 137 - show_val_kb(m, "FilePmdMapped: ", 137 + show_val_kb(m, "FilePmdMapped: ", 138 138 global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR); 139 139 #endif 140 140
+16 -12
fs/proc/page.c
··· 42 42 return -EINVAL; 43 43 44 44 while (count > 0) { 45 - if (pfn_valid(pfn)) 46 - ppage = pfn_to_page(pfn); 47 - else 48 - ppage = NULL; 45 + /* 46 + * TODO: ZONE_DEVICE support requires to identify 47 + * memmaps that were actually initialized. 48 + */ 49 + ppage = pfn_to_online_page(pfn); 50 + 49 51 if (!ppage || PageSlab(ppage) || page_has_type(ppage)) 50 52 pcount = 0; 51 53 else ··· 218 216 return -EINVAL; 219 217 220 218 while (count > 0) { 221 - if (pfn_valid(pfn)) 222 - ppage = pfn_to_page(pfn); 223 - else 224 - ppage = NULL; 219 + /* 220 + * TODO: ZONE_DEVICE support requires to identify 221 + * memmaps that were actually initialized. 222 + */ 223 + ppage = pfn_to_online_page(pfn); 225 224 226 225 if (put_user(stable_page_flags(ppage), out)) { 227 226 ret = -EFAULT; ··· 264 261 return -EINVAL; 265 262 266 263 while (count > 0) { 267 - if (pfn_valid(pfn)) 268 - ppage = pfn_to_page(pfn); 269 - else 270 - ppage = NULL; 264 + /* 265 + * TODO: ZONE_DEVICE support requires to identify 266 + * memmaps that were actually initialized. 267 + */ 268 + ppage = pfn_to_online_page(pfn); 271 269 272 270 if (ppage) 273 271 ino = page_cgroup_ino(ppage);
+11 -2
kernel/events/uprobes.c
··· 474 474 struct vm_area_struct *vma; 475 475 int ret, is_register, ref_ctr_updated = 0; 476 476 bool orig_page_huge = false; 477 + unsigned int gup_flags = FOLL_FORCE; 477 478 478 479 is_register = is_swbp_insn(&opcode); 479 480 uprobe = container_of(auprobe, struct uprobe, arch); 480 481 481 482 retry: 483 + if (is_register) 484 + gup_flags |= FOLL_SPLIT_PMD; 482 485 /* Read the page with vaddr into memory */ 483 - ret = get_user_pages_remote(NULL, mm, vaddr, 1, 484 - FOLL_FORCE | FOLL_SPLIT_PMD, &old_page, &vma, NULL); 486 + ret = get_user_pages_remote(NULL, mm, vaddr, 1, gup_flags, 487 + &old_page, &vma, NULL); 485 488 if (ret <= 0) 486 489 return ret; 487 490 488 491 ret = verify_opcode(old_page, vaddr, &opcode); 489 492 if (ret <= 0) 490 493 goto put_old; 494 + 495 + if (WARN(!is_register && PageCompound(old_page), 496 + "uprobe unregister should never work on compound page\n")) { 497 + ret = -EINVAL; 498 + goto put_old; 499 + } 491 500 492 501 /* We are going to replace instruction, update ref_ctr. */ 493 502 if (!ref_ctr_updated && uprobe->ref_ctr_offset) {
+1
mm/filemap.c
··· 40 40 #include <linux/rmap.h> 41 41 #include <linux/delayacct.h> 42 42 #include <linux/psi.h> 43 + #include <linux/ramfs.h> 43 44 #include "internal.h" 44 45 45 46 #define CREATE_TRACE_POINTS
+8 -6
mm/gup.c
··· 1973 1973 } 1974 1974 1975 1975 static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, 1976 - unsigned long end, int write, struct page **pages, int *nr) 1976 + unsigned long end, unsigned int flags, 1977 + struct page **pages, int *nr) 1977 1978 { 1978 1979 unsigned long pte_end; 1979 1980 struct page *head, *page; ··· 1987 1986 1988 1987 pte = READ_ONCE(*ptep); 1989 1988 1990 - if (!pte_access_permitted(pte, write)) 1989 + if (!pte_access_permitted(pte, flags & FOLL_WRITE)) 1991 1990 return 0; 1992 1991 1993 1992 /* hugepages are never "special" */ ··· 2024 2023 } 2025 2024 2026 2025 static int gup_huge_pd(hugepd_t hugepd, unsigned long addr, 2027 - unsigned int pdshift, unsigned long end, int write, 2026 + unsigned int pdshift, unsigned long end, unsigned int flags, 2028 2027 struct page **pages, int *nr) 2029 2028 { 2030 2029 pte_t *ptep; ··· 2034 2033 ptep = hugepte_offset(hugepd, addr, pdshift); 2035 2034 do { 2036 2035 next = hugepte_addr_end(addr, end, sz); 2037 - if (!gup_hugepte(ptep, sz, addr, end, write, pages, nr)) 2036 + if (!gup_hugepte(ptep, sz, addr, end, flags, pages, nr)) 2038 2037 return 0; 2039 2038 } while (ptep++, addr = next, addr != end); 2040 2039 ··· 2042 2041 } 2043 2042 #else 2044 2043 static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr, 2045 - unsigned pdshift, unsigned long end, int write, 2044 + unsigned int pdshift, unsigned long end, unsigned int flags, 2046 2045 struct page **pages, int *nr) 2047 2046 { 2048 2047 return 0; ··· 2050 2049 #endif /* CONFIG_ARCH_HAS_HUGEPD */ 2051 2050 2052 2051 static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, 2053 - unsigned long end, unsigned int flags, struct page **pages, int *nr) 2052 + unsigned long end, unsigned int flags, 2053 + struct page **pages, int *nr) 2054 2054 { 2055 2055 struct page *head, *page; 2056 2056 int refs;
+7 -2
mm/huge_memory.c
··· 2789 2789 ds_queue->split_queue_len--; 2790 2790 list_del(page_deferred_list(head)); 2791 2791 } 2792 - if (mapping) 2793 - __dec_node_page_state(page, NR_SHMEM_THPS); 2792 + if (mapping) { 2793 + if (PageSwapBacked(page)) 2794 + __dec_node_page_state(page, NR_SHMEM_THPS); 2795 + else 2796 + __dec_node_page_state(page, NR_FILE_THPS); 2797 + } 2798 + 2794 2799 spin_unlock(&ds_queue->split_queue_lock); 2795 2800 __split_huge_page(page, list, end, flags); 2796 2801 if (PageSwapCache(head)) {
+2 -3
mm/hugetlb.c
··· 1084 1084 struct page *page; 1085 1085 1086 1086 for (i = start_pfn; i < end_pfn; i++) { 1087 - if (!pfn_valid(i)) 1087 + page = pfn_to_online_page(i); 1088 + if (!page) 1088 1089 return false; 1089 - 1090 - page = pfn_to_page(i); 1091 1090 1092 1091 if (page_zone(page) != z) 1093 1092 return false;
+1
mm/init-mm.c
··· 5 5 #include <linux/spinlock.h> 6 6 #include <linux/list.h> 7 7 #include <linux/cpumask.h> 8 + #include <linux/mman.h> 8 9 9 10 #include <linux/atomic.h> 10 11 #include <linux/user_namespace.h>
+3 -3
mm/memblock.c
··· 1356 1356 align = SMP_CACHE_BYTES; 1357 1357 } 1358 1358 1359 - if (end > memblock.current_limit) 1360 - end = memblock.current_limit; 1361 - 1362 1359 again: 1363 1360 found = memblock_find_in_range_node(size, align, start, end, nid, 1364 1361 flags); ··· 1465 1468 */ 1466 1469 if (WARN_ON_ONCE(slab_is_available())) 1467 1470 return kzalloc_node(size, GFP_NOWAIT, nid); 1471 + 1472 + if (max_addr > memblock.current_limit) 1473 + max_addr = memblock.current_limit; 1468 1474 1469 1475 alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid); 1470 1476
+12 -6
mm/memcontrol.c
··· 5420 5420 struct mem_cgroup *from, 5421 5421 struct mem_cgroup *to) 5422 5422 { 5423 + struct lruvec *from_vec, *to_vec; 5424 + struct pglist_data *pgdat; 5423 5425 unsigned long flags; 5424 5426 unsigned int nr_pages = compound ? hpage_nr_pages(page) : 1; 5425 5427 int ret; ··· 5445 5443 5446 5444 anon = PageAnon(page); 5447 5445 5446 + pgdat = page_pgdat(page); 5447 + from_vec = mem_cgroup_lruvec(pgdat, from); 5448 + to_vec = mem_cgroup_lruvec(pgdat, to); 5449 + 5448 5450 spin_lock_irqsave(&from->move_lock, flags); 5449 5451 5450 5452 if (!anon && page_mapped(page)) { 5451 - __mod_memcg_state(from, NR_FILE_MAPPED, -nr_pages); 5452 - __mod_memcg_state(to, NR_FILE_MAPPED, nr_pages); 5453 + __mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages); 5454 + __mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages); 5453 5455 } 5454 5456 5455 5457 /* ··· 5465 5459 struct address_space *mapping = page_mapping(page); 5466 5460 5467 5461 if (mapping_cap_account_dirty(mapping)) { 5468 - __mod_memcg_state(from, NR_FILE_DIRTY, -nr_pages); 5469 - __mod_memcg_state(to, NR_FILE_DIRTY, nr_pages); 5462 + __mod_lruvec_state(from_vec, NR_FILE_DIRTY, -nr_pages); 5463 + __mod_lruvec_state(to_vec, NR_FILE_DIRTY, nr_pages); 5470 5464 } 5471 5465 } 5472 5466 5473 5467 if (PageWriteback(page)) { 5474 - __mod_memcg_state(from, NR_WRITEBACK, -nr_pages); 5475 - __mod_memcg_state(to, NR_WRITEBACK, nr_pages); 5468 + __mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages); 5469 + __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages); 5476 5470 } 5477 5471 5478 5472 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+8 -6
mm/memory-failure.c
··· 1257 1257 if (!sysctl_memory_failure_recovery) 1258 1258 panic("Memory failure on page %lx", pfn); 1259 1259 1260 - if (!pfn_valid(pfn)) { 1260 + p = pfn_to_online_page(pfn); 1261 + if (!p) { 1262 + if (pfn_valid(pfn)) { 1263 + pgmap = get_dev_pagemap(pfn, NULL); 1264 + if (pgmap) 1265 + return memory_failure_dev_pagemap(pfn, flags, 1266 + pgmap); 1267 + } 1261 1268 pr_err("Memory failure: %#lx: memory outside kernel control\n", 1262 1269 pfn); 1263 1270 return -ENXIO; 1264 1271 } 1265 1272 1266 - pgmap = get_dev_pagemap(pfn, NULL); 1267 - if (pgmap) 1268 - return memory_failure_dev_pagemap(pfn, flags, pgmap); 1269 - 1270 - p = pfn_to_page(pfn); 1271 1273 if (PageHuge(p)) 1272 1274 return memory_failure_hugetlb(pfn, flags); 1273 1275 if (TestSetPageHWPoison(p)) {
+16 -58
mm/memory_hotplug.c
··· 436 436 zone_span_writeunlock(zone); 437 437 } 438 438 439 - static void shrink_pgdat_span(struct pglist_data *pgdat, 440 - unsigned long start_pfn, unsigned long end_pfn) 439 + static void update_pgdat_span(struct pglist_data *pgdat) 441 440 { 442 - unsigned long pgdat_start_pfn = pgdat->node_start_pfn; 443 - unsigned long p = pgdat_end_pfn(pgdat); /* pgdat_end_pfn namespace clash */ 444 - unsigned long pgdat_end_pfn = p; 445 - unsigned long pfn; 446 - int nid = pgdat->node_id; 441 + unsigned long node_start_pfn = 0, node_end_pfn = 0; 442 + struct zone *zone; 447 443 448 - if (pgdat_start_pfn == start_pfn) { 449 - /* 450 - * If the section is smallest section in the pgdat, it need 451 - * shrink pgdat->node_start_pfn and pgdat->node_spanned_pages. 452 - * In this case, we find second smallest valid mem_section 453 - * for shrinking zone. 454 - */ 455 - pfn = find_smallest_section_pfn(nid, NULL, end_pfn, 456 - pgdat_end_pfn); 457 - if (pfn) { 458 - pgdat->node_start_pfn = pfn; 459 - pgdat->node_spanned_pages = pgdat_end_pfn - pfn; 460 - } 461 - } else if (pgdat_end_pfn == end_pfn) { 462 - /* 463 - * If the section is biggest section in the pgdat, it need 464 - * shrink pgdat->node_spanned_pages. 465 - * In this case, we find second biggest valid mem_section for 466 - * shrinking zone. 467 - */ 468 - pfn = find_biggest_section_pfn(nid, NULL, pgdat_start_pfn, 469 - start_pfn); 470 - if (pfn) 471 - pgdat->node_spanned_pages = pfn - pgdat_start_pfn + 1; 444 + for (zone = pgdat->node_zones; 445 + zone < pgdat->node_zones + MAX_NR_ZONES; zone++) { 446 + unsigned long zone_end_pfn = zone->zone_start_pfn + 447 + zone->spanned_pages; 448 + 449 + /* No need to lock the zones, they can't change. */ 450 + if (zone_end_pfn > node_end_pfn) 451 + node_end_pfn = zone_end_pfn; 452 + if (zone->zone_start_pfn < node_start_pfn) 453 + node_start_pfn = zone->zone_start_pfn; 472 454 } 473 455 474 - /* 475 - * If the section is not biggest or smallest mem_section in the pgdat, 476 - * it only creates a hole in the pgdat. So in this case, we need not 477 - * change the pgdat. 478 - * But perhaps, the pgdat has only hole data. Thus it check the pgdat 479 - * has only hole or not. 480 - */ 481 - pfn = pgdat_start_pfn; 482 - for (; pfn < pgdat_end_pfn; pfn += PAGES_PER_SUBSECTION) { 483 - if (unlikely(!pfn_valid(pfn))) 484 - continue; 485 - 486 - if (pfn_to_nid(pfn) != nid) 487 - continue; 488 - 489 - /* Skip range to be removed */ 490 - if (pfn >= start_pfn && pfn < end_pfn) 491 - continue; 492 - 493 - /* If we find valid section, we have nothing to do */ 494 - return; 495 - } 496 - 497 - /* The pgdat has no valid section */ 498 - pgdat->node_start_pfn = 0; 499 - pgdat->node_spanned_pages = 0; 456 + pgdat->node_start_pfn = node_start_pfn; 457 + pgdat->node_spanned_pages = node_end_pfn - node_start_pfn; 500 458 } 501 459 502 460 static void __remove_zone(struct zone *zone, unsigned long start_pfn, ··· 465 507 466 508 pgdat_resize_lock(zone->zone_pgdat, &flags); 467 509 shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); 468 - shrink_pgdat_span(pgdat, start_pfn, start_pfn + nr_pages); 510 + update_pgdat_span(pgdat); 469 511 pgdat_resize_unlock(zone->zone_pgdat, &flags); 470 512 } 471 513
+7 -4
mm/memremap.c
··· 103 103 void memunmap_pages(struct dev_pagemap *pgmap) 104 104 { 105 105 struct resource *res = &pgmap->res; 106 + struct page *first_page; 106 107 unsigned long pfn; 107 108 int nid; 108 109 ··· 112 111 put_page(pfn_to_page(pfn)); 113 112 dev_pagemap_cleanup(pgmap); 114 113 114 + /* make sure to access a memmap that was actually initialized */ 115 + first_page = pfn_to_page(pfn_first(pgmap)); 116 + 115 117 /* pages are dead and unused, undo the arch mapping */ 116 - nid = page_to_nid(pfn_to_page(PHYS_PFN(res->start))); 118 + nid = page_to_nid(first_page); 117 119 118 120 mem_hotplug_begin(); 119 121 if (pgmap->type == MEMORY_DEVICE_PRIVATE) { 120 - pfn = PHYS_PFN(res->start); 121 - __remove_pages(page_zone(pfn_to_page(pfn)), pfn, 122 - PHYS_PFN(resource_size(res)), NULL); 122 + __remove_pages(page_zone(first_page), PHYS_PFN(res->start), 123 + PHYS_PFN(resource_size(res)), NULL); 123 124 } else { 124 125 arch_remove_memory(nid, res->start, resource_size(res), 125 126 pgmap_altmap(pgmap));
+3 -2
mm/page_owner.c
··· 271 271 * not matter as the mixed block count will still be correct 272 272 */ 273 273 for (; pfn < end_pfn; ) { 274 - if (!pfn_valid(pfn)) { 274 + page = pfn_to_online_page(pfn); 275 + if (!page) { 275 276 pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES); 276 277 continue; 277 278 } ··· 280 279 block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); 281 280 block_end_pfn = min(block_end_pfn, end_pfn); 282 281 283 - page = pfn_to_page(pfn); 284 282 pageblock_mt = get_pageblock_migratetype(page); 285 283 286 284 for (; pfn < block_end_pfn; pfn++) { 287 285 if (!pfn_valid_within(pfn)) 288 286 continue; 289 287 288 + /* The pageblock is online, no need to recheck. */ 290 289 page = pfn_to_page(pfn); 291 290 292 291 if (page_zone(page) != zone)
+1
mm/rmap.c
··· 61 61 #include <linux/mmu_notifier.h> 62 62 #include <linux/migrate.h> 63 63 #include <linux/hugetlb.h> 64 + #include <linux/huge_mm.h> 64 65 #include <linux/backing-dev.h> 65 66 #include <linux/page_idle.h> 66 67 #include <linux/memremap.h>
+5 -4
mm/slab_common.c
··· 178 178 179 179 static void destroy_memcg_params(struct kmem_cache *s) 180 180 { 181 - if (is_root_cache(s)) 181 + if (is_root_cache(s)) { 182 182 kvfree(rcu_access_pointer(s->memcg_params.memcg_caches)); 183 - else 183 + } else { 184 + mem_cgroup_put(s->memcg_params.memcg); 185 + WRITE_ONCE(s->memcg_params.memcg, NULL); 184 186 percpu_ref_exit(&s->memcg_params.refcnt); 187 + } 185 188 } 186 189 187 190 static void free_memcg_params(struct rcu_head *rcu) ··· 256 253 } else { 257 254 list_del(&s->memcg_params.children_node); 258 255 list_del(&s->memcg_params.kmem_caches_node); 259 - mem_cgroup_put(s->memcg_params.memcg); 260 - WRITE_ONCE(s->memcg_params.memcg, NULL); 261 256 } 262 257 } 263 258 #else
+12
mm/truncate.c
··· 592 592 unlock_page(page); 593 593 continue; 594 594 } 595 + 596 + /* Take a pin outside pagevec */ 597 + get_page(page); 598 + 599 + /* 600 + * Drop extra pins before trying to invalidate 601 + * the huge page. 602 + */ 603 + pagevec_remove_exceptionals(&pvec); 604 + pagevec_release(&pvec); 595 605 } 596 606 597 607 ret = invalidate_inode_page(page); ··· 612 602 */ 613 603 if (!ret) 614 604 deactivate_file_page(page); 605 + if (PageTransHuge(page)) 606 + put_page(page); 615 607 count += ret; 616 608 } 617 609 pagevec_remove_exceptionals(&pvec);
+6 -8
mm/vmscan.c
··· 351 351 */ 352 352 unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) 353 353 { 354 - unsigned long lru_size; 354 + unsigned long lru_size = 0; 355 355 int zid; 356 356 357 - if (!mem_cgroup_disabled()) 358 - lru_size = lruvec_page_state_local(lruvec, NR_LRU_BASE + lru); 359 - else 357 + if (!mem_cgroup_disabled()) { 358 + for (zid = 0; zid < MAX_NR_ZONES; zid++) 359 + lru_size += mem_cgroup_get_zone_lru_size(lruvec, lru, zid); 360 + } else 360 361 lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); 361 362 362 363 for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) { ··· 933 932 * Note that if SetPageDirty is always performed via set_page_dirty, 934 933 * and thus under the i_pages lock, then this ordering is not required. 935 934 */ 936 - if (unlikely(PageTransHuge(page)) && PageSwapCache(page)) 937 - refcount = 1 + HPAGE_PMD_NR; 938 - else 939 - refcount = 2; 935 + refcount = 1 + compound_nr(page); 940 936 if (!page_ref_freeze(page, refcount)) 941 937 goto cannot_free; 942 938 /* note: atomic_cmpxchg in page_ref_freeze provides the smp_rmb */
+12 -4
scripts/gdb/linux/dmesg.py
··· 16 16 17 17 from linux import utils 18 18 19 + printk_log_type = utils.CachedType("struct printk_log") 20 + 19 21 20 22 class LxDmesg(gdb.Command): 21 23 """Print Linux kernel log buffer.""" ··· 44 42 b = utils.read_memoryview(inf, log_buf_addr, log_next_idx) 45 43 log_buf = a.tobytes() + b.tobytes() 46 44 45 + length_offset = printk_log_type.get_type()['len'].bitpos // 8 46 + text_len_offset = printk_log_type.get_type()['text_len'].bitpos // 8 47 + time_stamp_offset = printk_log_type.get_type()['ts_nsec'].bitpos // 8 48 + text_offset = printk_log_type.get_type().sizeof 49 + 47 50 pos = 0 48 51 while pos < log_buf.__len__(): 49 - length = utils.read_u16(log_buf[pos + 8:pos + 10]) 52 + length = utils.read_u16(log_buf, pos + length_offset) 50 53 if length == 0: 51 54 if log_buf_2nd_half == -1: 52 55 gdb.write("Corrupted log buffer!\n") ··· 59 52 pos = log_buf_2nd_half 60 53 continue 61 54 62 - text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) 63 - text = log_buf[pos + 16:pos + 16 + text_len].decode( 55 + text_len = utils.read_u16(log_buf, pos + text_len_offset) 56 + text_start = pos + text_offset 57 + text = log_buf[text_start:text_start + text_len].decode( 64 58 encoding='utf8', errors='replace') 65 - time_stamp = utils.read_u64(log_buf[pos:pos + 8]) 59 + time_stamp = utils.read_u64(log_buf, pos + time_stamp_offset) 66 60 67 61 for line in text.splitlines(): 68 62 msg = u"[{time:12.6f}] {line}\n".format(
+7 -1
scripts/gdb/linux/symbols.py
··· 15 15 import os 16 16 import re 17 17 18 - from linux import modules 18 + from linux import modules, utils 19 19 20 20 21 21 if hasattr(gdb, 'Breakpoint'): ··· 116 116 module_file = self._get_module_file(module_name) 117 117 118 118 if module_file: 119 + if utils.is_target_arch('s390'): 120 + # Module text is preceded by PLT stubs on s390. 121 + module_arch = module['arch'] 122 + plt_offset = int(module_arch['plt_offset']) 123 + plt_size = int(module_arch['plt_size']) 124 + module_addr = hex(int(module_addr, 0) + plt_offset + plt_size) 119 125 gdb.write("loading @{addr}: {filename}\n".format( 120 126 addr=module_addr, filename=module_file)) 121 127 cmdline = "add-symbol-file {filename} {addr}{sections}".format(
+13 -12
scripts/gdb/linux/utils.py
··· 92 92 return memoryview(inf.read_memory(start, length)) 93 93 94 94 95 - def read_u16(buffer): 95 + def read_u16(buffer, offset): 96 + buffer_val = buffer[offset:offset + 2] 96 97 value = [0, 0] 97 98 98 - if type(buffer[0]) is str: 99 - value[0] = ord(buffer[0]) 100 - value[1] = ord(buffer[1]) 99 + if type(buffer_val[0]) is str: 100 + value[0] = ord(buffer_val[0]) 101 + value[1] = ord(buffer_val[1]) 101 102 else: 102 - value[0] = buffer[0] 103 - value[1] = buffer[1] 103 + value[0] = buffer_val[0] 104 + value[1] = buffer_val[1] 104 105 105 106 if get_target_endianness() == LITTLE_ENDIAN: 106 107 return value[0] + (value[1] << 8) ··· 109 108 return value[1] + (value[0] << 8) 110 109 111 110 112 - def read_u32(buffer): 111 + def read_u32(buffer, offset): 113 112 if get_target_endianness() == LITTLE_ENDIAN: 114 - return read_u16(buffer[0:2]) + (read_u16(buffer[2:4]) << 16) 113 + return read_u16(buffer, offset) + (read_u16(buffer, offset + 2) << 16) 115 114 else: 116 - return read_u16(buffer[2:4]) + (read_u16(buffer[0:2]) << 16) 115 + return read_u16(buffer, offset + 2) + (read_u16(buffer, offset) << 16) 117 116 118 117 119 - def read_u64(buffer): 118 + def read_u64(buffer, offset): 120 119 if get_target_endianness() == LITTLE_ENDIAN: 121 - return read_u32(buffer[0:4]) + (read_u32(buffer[4:8]) << 32) 120 + return read_u32(buffer, offset) + (read_u32(buffer, offset + 4) << 32) 122 121 else: 123 - return read_u32(buffer[4:8]) + (read_u32(buffer[0:4]) << 32) 122 + return read_u32(buffer, offset + 4) + (read_u32(buffer, offset) << 32) 124 123 125 124 126 125 target_arch = None
+1 -1
tools/testing/selftests/vm/gup_benchmark.c
··· 37 37 char *file = "/dev/zero"; 38 38 char *p; 39 39 40 - while ((opt = getopt(argc, argv, "m:r:n:f:tTLUSH")) != -1) { 40 + while ((opt = getopt(argc, argv, "m:r:n:f:tTLUwSH")) != -1) { 41 41 switch (opt) { 42 42 case 'm': 43 43 size = atoi(optarg) * MB;