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

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
sh: add copy_user_page() alias for __copy_user()
lib/Kconfig: ZLIB_DEFLATE must select BITREVERSE
mm, dax: fix DAX deadlocks
memcg: convert threshold to bytes
builddeb: remove debian/files before build
mm, fs: obey gfp_mapping for add_to_page_cache()

+58 -61
+1
arch/sh/include/asm/page.h
··· 59 59 60 60 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 61 61 extern void copy_page(void *to, void *from); 62 + #define copy_user_page(to, from, vaddr, pg) __copy_user(to, from, PAGE_SIZE) 62 63 63 64 struct page; 64 65 struct vm_area_struct;
+1 -1
drivers/staging/lustre/lustre/llite/dir.c
··· 224 224 225 225 prefetchw(&page->flags); 226 226 ret = add_to_page_cache_lru(page, inode->i_mapping, offset, 227 - GFP_KERNEL); 227 + GFP_NOFS); 228 228 if (ret == 0) { 229 229 unlock_page(page); 230 230 } else {
+3 -3
fs/cifs/file.c
··· 3380 3380 struct page *page, *tpage; 3381 3381 unsigned int expected_index; 3382 3382 int rc; 3383 + gfp_t gfp = GFP_KERNEL & mapping_gfp_mask(mapping); 3383 3384 3384 3385 INIT_LIST_HEAD(tmplist); 3385 3386 ··· 3393 3392 */ 3394 3393 __set_page_locked(page); 3395 3394 rc = add_to_page_cache_locked(page, mapping, 3396 - page->index, GFP_KERNEL); 3395 + page->index, gfp); 3397 3396 3398 3397 /* give up if we can't stick it in the cache */ 3399 3398 if (rc) { ··· 3419 3418 break; 3420 3419 3421 3420 __set_page_locked(page); 3422 - if (add_to_page_cache_locked(page, mapping, page->index, 3423 - GFP_KERNEL)) { 3421 + if (add_to_page_cache_locked(page, mapping, page->index, gfp)) { 3424 3422 __clear_page_locked(page); 3425 3423 break; 3426 3424 }
+29 -41
fs/dax.c
··· 285 285 static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh, 286 286 struct vm_area_struct *vma, struct vm_fault *vmf) 287 287 { 288 + struct address_space *mapping = inode->i_mapping; 288 289 sector_t sector = bh->b_blocknr << (inode->i_blkbits - 9); 289 290 unsigned long vaddr = (unsigned long)vmf->virtual_address; 290 291 void __pmem *addr; 291 292 unsigned long pfn; 292 293 pgoff_t size; 293 294 int error; 295 + 296 + i_mmap_lock_read(mapping); 294 297 295 298 /* 296 299 * Check truncate didn't happen while we were allocating a block. ··· 324 321 error = vm_insert_mixed(vma, vaddr, pfn); 325 322 326 323 out: 324 + i_mmap_unlock_read(mapping); 325 + 327 326 return error; 328 327 } 329 328 ··· 387 382 * from a read fault and we've raced with a truncate 388 383 */ 389 384 error = -EIO; 390 - goto unlock; 385 + goto unlock_page; 391 386 } 392 - } else { 393 - i_mmap_lock_write(mapping); 394 387 } 395 388 396 389 error = get_block(inode, block, &bh, 0); 397 390 if (!error && (bh.b_size < PAGE_SIZE)) 398 391 error = -EIO; /* fs corruption? */ 399 392 if (error) 400 - goto unlock; 393 + goto unlock_page; 401 394 402 395 if (!buffer_mapped(&bh) && !buffer_unwritten(&bh) && !vmf->cow_page) { 403 396 if (vmf->flags & FAULT_FLAG_WRITE) { ··· 406 403 if (!error && (bh.b_size < PAGE_SIZE)) 407 404 error = -EIO; 408 405 if (error) 409 - goto unlock; 406 + goto unlock_page; 410 407 } else { 411 - i_mmap_unlock_write(mapping); 412 408 return dax_load_hole(mapping, page, vmf); 413 409 } 414 410 } ··· 419 417 else 420 418 clear_user_highpage(new_page, vaddr); 421 419 if (error) 422 - goto unlock; 420 + goto unlock_page; 423 421 vmf->page = page; 424 422 if (!page) { 423 + i_mmap_lock_read(mapping); 425 424 /* Check we didn't race with truncate */ 426 425 size = (i_size_read(inode) + PAGE_SIZE - 1) >> 427 426 PAGE_SHIFT; 428 427 if (vmf->pgoff >= size) { 428 + i_mmap_unlock_read(mapping); 429 429 error = -EIO; 430 - goto unlock; 430 + goto out; 431 431 } 432 432 } 433 433 return VM_FAULT_LOCKED; ··· 465 461 WARN_ON_ONCE(!(vmf->flags & FAULT_FLAG_WRITE)); 466 462 } 467 463 468 - if (!page) 469 - i_mmap_unlock_write(mapping); 470 464 out: 471 465 if (error == -ENOMEM) 472 466 return VM_FAULT_OOM | major; ··· 473 471 return VM_FAULT_SIGBUS | major; 474 472 return VM_FAULT_NOPAGE | major; 475 473 476 - unlock: 474 + unlock_page: 477 475 if (page) { 478 476 unlock_page(page); 479 477 page_cache_release(page); 480 - } else { 481 - i_mmap_unlock_write(mapping); 482 478 } 483 - 484 479 goto out; 485 480 } 486 481 EXPORT_SYMBOL(__dax_fault); ··· 555 556 block = (sector_t)pgoff << (PAGE_SHIFT - blkbits); 556 557 557 558 bh.b_size = PMD_SIZE; 558 - i_mmap_lock_write(mapping); 559 559 length = get_block(inode, block, &bh, write); 560 560 if (length) 561 561 return VM_FAULT_SIGBUS; 562 + i_mmap_lock_read(mapping); 562 563 563 564 /* 564 565 * If the filesystem isn't willing to tell us the length of a hole, ··· 568 569 if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) 569 570 goto fallback; 570 571 571 - sector = bh.b_blocknr << (blkbits - 9); 572 - 573 - if (buffer_unwritten(&bh) || buffer_new(&bh)) { 574 - int i; 575 - 576 - length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn, 577 - bh.b_size); 578 - if (length < 0) { 579 - result = VM_FAULT_SIGBUS; 580 - goto out; 581 - } 582 - if ((length < PMD_SIZE) || (pfn & PG_PMD_COLOUR)) 583 - goto fallback; 584 - 585 - for (i = 0; i < PTRS_PER_PMD; i++) 586 - clear_pmem(kaddr + i * PAGE_SIZE, PAGE_SIZE); 587 - wmb_pmem(); 588 - count_vm_event(PGMAJFAULT); 589 - mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT); 590 - result |= VM_FAULT_MAJOR; 591 - } 592 - 593 572 /* 594 573 * If we allocated new storage, make sure no process has any 595 574 * zero pages covering this hole 596 575 */ 597 576 if (buffer_new(&bh)) { 598 - i_mmap_unlock_write(mapping); 577 + i_mmap_unlock_read(mapping); 599 578 unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0); 600 - i_mmap_lock_write(mapping); 579 + i_mmap_lock_read(mapping); 601 580 } 602 581 603 582 /* ··· 612 635 result = VM_FAULT_NOPAGE; 613 636 spin_unlock(ptl); 614 637 } else { 638 + sector = bh.b_blocknr << (blkbits - 9); 615 639 length = bdev_direct_access(bh.b_bdev, sector, &kaddr, &pfn, 616 640 bh.b_size); 617 641 if (length < 0) { ··· 622 644 if ((length < PMD_SIZE) || (pfn & PG_PMD_COLOUR)) 623 645 goto fallback; 624 646 647 + if (buffer_unwritten(&bh) || buffer_new(&bh)) { 648 + int i; 649 + for (i = 0; i < PTRS_PER_PMD; i++) 650 + clear_pmem(kaddr + i * PAGE_SIZE, PAGE_SIZE); 651 + wmb_pmem(); 652 + count_vm_event(PGMAJFAULT); 653 + mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT); 654 + result |= VM_FAULT_MAJOR; 655 + } 656 + 625 657 result |= vmf_insert_pfn_pmd(vma, address, pmd, pfn, write); 626 658 } 627 659 628 660 out: 661 + i_mmap_unlock_read(mapping); 662 + 629 663 if (buffer_unwritten(&bh)) 630 664 complete_unwritten(&bh, !(result & VM_FAULT_ERROR)); 631 - 632 - i_mmap_unlock_write(mapping); 633 665 634 666 return result; 635 667
+2 -2
fs/ext4/readpage.c
··· 165 165 if (pages) { 166 166 page = list_entry(pages->prev, struct page, lru); 167 167 list_del(&page->lru); 168 - if (add_to_page_cache_lru(page, mapping, 169 - page->index, GFP_KERNEL)) 168 + if (add_to_page_cache_lru(page, mapping, page->index, 169 + GFP_KERNEL & mapping_gfp_mask(mapping))) 170 170 goto next_page; 171 171 } 172 172
+9 -6
fs/mpage.c
··· 139 139 static struct bio * 140 140 do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages, 141 141 sector_t *last_block_in_bio, struct buffer_head *map_bh, 142 - unsigned long *first_logical_block, get_block_t get_block) 142 + unsigned long *first_logical_block, get_block_t get_block, 143 + gfp_t gfp) 143 144 { 144 145 struct inode *inode = page->mapping->host; 145 146 const unsigned blkbits = inode->i_blkbits; ··· 278 277 goto out; 279 278 } 280 279 bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9), 281 - min_t(int, nr_pages, BIO_MAX_PAGES), 282 - GFP_KERNEL); 280 + min_t(int, nr_pages, BIO_MAX_PAGES), gfp); 283 281 if (bio == NULL) 284 282 goto confused; 285 283 } ··· 361 361 sector_t last_block_in_bio = 0; 362 362 struct buffer_head map_bh; 363 363 unsigned long first_logical_block = 0; 364 + gfp_t gfp = GFP_KERNEL & mapping_gfp_mask(mapping); 364 365 365 366 map_bh.b_state = 0; 366 367 map_bh.b_size = 0; ··· 371 370 prefetchw(&page->flags); 372 371 list_del(&page->lru); 373 372 if (!add_to_page_cache_lru(page, mapping, 374 - page->index, GFP_KERNEL)) { 373 + page->index, 374 + gfp)) { 375 375 bio = do_mpage_readpage(bio, page, 376 376 nr_pages - page_idx, 377 377 &last_block_in_bio, &map_bh, 378 378 &first_logical_block, 379 - get_block); 379 + get_block, gfp); 380 380 } 381 381 page_cache_release(page); 382 382 } ··· 397 395 sector_t last_block_in_bio = 0; 398 396 struct buffer_head map_bh; 399 397 unsigned long first_logical_block = 0; 398 + gfp_t gfp = GFP_KERNEL & mapping_gfp_mask(page->mapping); 400 399 401 400 map_bh.b_state = 0; 402 401 map_bh.b_size = 0; 403 402 bio = do_mpage_readpage(bio, page, 1, &last_block_in_bio, 404 - &map_bh, &first_logical_block, get_block); 403 + &map_bh, &first_logical_block, get_block, gfp); 405 404 if (bio) 406 405 mpage_bio_submit(READ, bio); 407 406 return 0;
+3 -2
fs/ramfs/file-nommu.c
··· 70 70 unsigned order; 71 71 void *data; 72 72 int ret; 73 + gfp_t gfp = mapping_gfp_mask(inode->i_mapping); 73 74 74 75 /* make various checks */ 75 76 order = get_order(newsize); ··· 85 84 86 85 /* allocate enough contiguous pages to be able to satisfy the 87 86 * request */ 88 - pages = alloc_pages(mapping_gfp_mask(inode->i_mapping), order); 87 + pages = alloc_pages(gfp, order); 89 88 if (!pages) 90 89 return -ENOMEM; 91 90 ··· 109 108 struct page *page = pages + loop; 110 109 111 110 ret = add_to_page_cache_lru(page, inode->i_mapping, loop, 112 - GFP_KERNEL); 111 + gfp); 113 112 if (ret < 0) 114 113 goto add_error; 115 114
+1
lib/Kconfig
··· 220 220 221 221 config ZLIB_DEFLATE 222 222 tristate 223 + select BITREVERSE 223 224 224 225 config LZO_COMPRESS 225 226 tristate
+1
mm/memcontrol.c
··· 3387 3387 ret = page_counter_memparse(args, "-1", &threshold); 3388 3388 if (ret) 3389 3389 return ret; 3390 + threshold <<= PAGE_SHIFT; 3390 3391 3391 3392 mutex_lock(&memcg->thresholds_lock); 3392 3393
+2
mm/memory.c
··· 2426 2426 if (details.last_index < details.first_index) 2427 2427 details.last_index = ULONG_MAX; 2428 2428 2429 + 2430 + /* DAX uses i_mmap_lock to serialise file truncate vs page fault */ 2429 2431 i_mmap_lock_write(mapping); 2430 2432 if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap))) 2431 2433 unmap_mapping_range_tree(&mapping->i_mmap, &details);
+4 -4
mm/readahead.c
··· 89 89 while (!list_empty(pages)) { 90 90 page = list_to_page(pages); 91 91 list_del(&page->lru); 92 - if (add_to_page_cache_lru(page, mapping, 93 - page->index, GFP_KERNEL)) { 92 + if (add_to_page_cache_lru(page, mapping, page->index, 93 + GFP_KERNEL & mapping_gfp_mask(mapping))) { 94 94 read_cache_pages_invalidate_page(mapping, page); 95 95 continue; 96 96 } ··· 127 127 for (page_idx = 0; page_idx < nr_pages; page_idx++) { 128 128 struct page *page = list_to_page(pages); 129 129 list_del(&page->lru); 130 - if (!add_to_page_cache_lru(page, mapping, 131 - page->index, GFP_KERNEL)) { 130 + if (!add_to_page_cache_lru(page, mapping, page->index, 131 + GFP_KERNEL & mapping_gfp_mask(mapping))) { 132 132 mapping->a_ops->readpage(filp, page); 133 133 } 134 134 page_cache_release(page);
+2 -2
scripts/package/builddeb
··· 115 115 BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)" 116 116 117 117 # Setup the directory structure 118 - rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" 118 + rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" $objtree/debian/files 119 119 mkdir -m 755 -p "$tmpdir/DEBIAN" 120 120 mkdir -p "$tmpdir/lib" "$tmpdir/boot" 121 121 mkdir -p "$fwdir/lib/firmware/$version/" ··· 408 408 \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg 409 409 410 410 clean: 411 - rm -rf debian/*tmp 411 + rm -rf debian/*tmp debian/files 412 412 mv debian/ debian.backup # debian/ might be cleaned away 413 413 \$(MAKE) clean 414 414 mv debian.backup debian