vmscan.c (c4843a7593a9df3ff5b1806084cefdfa81dd7c79) vmscan.c (703c270887bb5106c4c46a00cc7477d30d5e04f5)
1/*
2 * linux/mm/vmscan.c
3 *
4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
5 *
6 * Swap reorganised 29.12.95, Stephen Tweedie.
7 * kswapd added: 7.1.96 sct
8 * Removed kswapd_ctl limits, and swap out as many pages as needed

--- 438 unchanged lines hidden (view full) ---

447 /*
448 * A freeable page cache page is referenced only by the caller
449 * that isolated the page, the page cache radix tree and
450 * optional buffer heads at page->private.
451 */
452 return page_count(page) - page_has_private(page) == 2;
453}
454
1/*
2 * linux/mm/vmscan.c
3 *
4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
5 *
6 * Swap reorganised 29.12.95, Stephen Tweedie.
7 * kswapd added: 7.1.96 sct
8 * Removed kswapd_ctl limits, and swap out as many pages as needed

--- 438 unchanged lines hidden (view full) ---

447 /*
448 * A freeable page cache page is referenced only by the caller
449 * that isolated the page, the page cache radix tree and
450 * optional buffer heads at page->private.
451 */
452 return page_count(page) - page_has_private(page) == 2;
453}
454
455static int may_write_to_queue(struct backing_dev_info *bdi,
456 struct scan_control *sc)
455static int may_write_to_inode(struct inode *inode, struct scan_control *sc)
457{
458 if (current->flags & PF_SWAPWRITE)
459 return 1;
456{
457 if (current->flags & PF_SWAPWRITE)
458 return 1;
460 if (!bdi_write_congested(bdi))
459 if (!inode_write_congested(inode))
461 return 1;
460 return 1;
462 if (bdi == current->backing_dev_info)
461 if (inode_to_bdi(inode) == current->backing_dev_info)
463 return 1;
464 return 0;
465}
466
467/*
468 * We detected a synchronous write error writing a page out. Probably
469 * -ENOSPC. We need to propagate that into the address_space for a subsequent
470 * fsync(), msync() or close().

--- 62 unchanged lines hidden (view full) ---

533 pr_info("%s: orphaned page\n", __func__);
534 return PAGE_CLEAN;
535 }
536 }
537 return PAGE_KEEP;
538 }
539 if (mapping->a_ops->writepage == NULL)
540 return PAGE_ACTIVATE;
462 return 1;
463 return 0;
464}
465
466/*
467 * We detected a synchronous write error writing a page out. Probably
468 * -ENOSPC. We need to propagate that into the address_space for a subsequent
469 * fsync(), msync() or close().

--- 62 unchanged lines hidden (view full) ---

532 pr_info("%s: orphaned page\n", __func__);
533 return PAGE_CLEAN;
534 }
535 }
536 return PAGE_KEEP;
537 }
538 if (mapping->a_ops->writepage == NULL)
539 return PAGE_ACTIVATE;
541 if (!may_write_to_queue(inode_to_bdi(mapping->host), sc))
540 if (!may_write_to_inode(mapping->host, sc))
542 return PAGE_KEEP;
543
544 if (clear_page_dirty_for_io(page)) {
545 int res;
546 struct writeback_control wbc = {
547 .sync_mode = WB_SYNC_NONE,
548 .nr_to_write = SWAP_CLUSTER_MAX,
549 .range_start = 0,

--- 369 unchanged lines hidden (view full) ---

919 /*
920 * Treat this page as congested if the underlying BDI is or if
921 * pages are cycling through the LRU so quickly that the
922 * pages marked for immediate reclaim are making it to the
923 * end of the LRU a second time.
924 */
925 mapping = page_mapping(page);
926 if (((dirty || writeback) && mapping &&
541 return PAGE_KEEP;
542
543 if (clear_page_dirty_for_io(page)) {
544 int res;
545 struct writeback_control wbc = {
546 .sync_mode = WB_SYNC_NONE,
547 .nr_to_write = SWAP_CLUSTER_MAX,
548 .range_start = 0,

--- 369 unchanged lines hidden (view full) ---

918 /*
919 * Treat this page as congested if the underlying BDI is or if
920 * pages are cycling through the LRU so quickly that the
921 * pages marked for immediate reclaim are making it to the
922 * end of the LRU a second time.
923 */
924 mapping = page_mapping(page);
925 if (((dirty || writeback) && mapping &&
927 bdi_write_congested(inode_to_bdi(mapping->host))) ||
926 inode_write_congested(mapping->host)) ||
928 (writeback && PageReclaim(page)))
929 nr_congested++;
930
931 /*
932 * If a page at the tail of the LRU is under writeback, there
933 * are three cases to consider.
934 *
935 * 1) If reclaim is encountering an excessive number of pages

--- 2900 unchanged lines hidden ---
927 (writeback && PageReclaim(page)))
928 nr_congested++;
929
930 /*
931 * If a page at the tail of the LRU is under writeback, there
932 * are three cases to consider.
933 *
934 * 1) If reclaim is encountering an excessive number of pages

--- 2900 unchanged lines hidden ---