Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83775
b: refs/heads/master
c: f1a9ee7
h: refs/heads/master
i:
  83773: a80e0d1
  83771: af6f2c3
  83767: 36763e7
  83759: c3ed69b
  83743: 6083148
  83711: c95b5eb
v: v3
  • Loading branch information
Rik van Riel authored and Linus Torvalds committed Feb 7, 2008
1 parent 839ec20 commit 6e5029a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fef1bdd68c81b71882ccb6f47c70980a03182063
refs/heads/master: f1a9ee758de7de1e040de849fdef46e6802ea117
27 changes: 22 additions & 5 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ struct scan_control {

int order;

/*
* Pages that have (or should have) IO pending. If we run into
* a lot of these, we're better off waiting a little for IO to
* finish rather than scanning more pages in the VM.
*/
int nr_io_pages;

/* Which cgroup do we reclaim from */
struct mem_cgroup *mem_cgroup;

Expand Down Expand Up @@ -499,8 +506,10 @@ static unsigned long shrink_page_list(struct list_head *page_list,
*/
if (sync_writeback == PAGEOUT_IO_SYNC && may_enter_fs)
wait_on_page_writeback(page);
else
else {
sc->nr_io_pages++;
goto keep_locked;
}
}

referenced = page_referenced(page, 1, sc->mem_cgroup);
Expand Down Expand Up @@ -539,8 +548,10 @@ static unsigned long shrink_page_list(struct list_head *page_list,
if (PageDirty(page)) {
if (sc->order <= PAGE_ALLOC_COSTLY_ORDER && referenced)
goto keep_locked;
if (!may_enter_fs)
if (!may_enter_fs) {
sc->nr_io_pages++;
goto keep_locked;
}
if (!sc->may_writepage)
goto keep_locked;

Expand All @@ -551,8 +562,10 @@ static unsigned long shrink_page_list(struct list_head *page_list,
case PAGE_ACTIVATE:
goto activate_locked;
case PAGE_SUCCESS:
if (PageWriteback(page) || PageDirty(page))
if (PageWriteback(page) || PageDirty(page)) {
sc->nr_io_pages++;
goto keep;
}
/*
* A synchronous write - probably a ramdisk. Go
* ahead and try to reclaim the page.
Expand Down Expand Up @@ -1259,6 +1272,7 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask,

for (priority = DEF_PRIORITY; priority >= 0; priority--) {
sc->nr_scanned = 0;
sc->nr_io_pages = 0;
if (!priority)
disable_swap_token();
nr_reclaimed += shrink_zones(priority, zones, sc);
Expand Down Expand Up @@ -1292,7 +1306,8 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask,
}

/* Take a nap, wait for some writeback to complete */
if (sc->nr_scanned && priority < DEF_PRIORITY - 2)
if (sc->nr_scanned && priority < DEF_PRIORITY - 2 &&
sc->nr_io_pages > sc->swap_cluster_max)
congestion_wait(WRITE, HZ/10);
}
/* top priority shrink_caches still had more to do? don't OOM, then */
Expand Down Expand Up @@ -1424,6 +1439,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
if (!priority)
disable_swap_token();

sc.nr_io_pages = 0;
all_zones_ok = 1;

/*
Expand Down Expand Up @@ -1516,7 +1532,8 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order)
* OK, kswapd is getting into trouble. Take a nap, then take
* another pass across the zones.
*/
if (total_scanned && priority < DEF_PRIORITY - 2)
if (total_scanned && priority < DEF_PRIORITY - 2 &&
sc.nr_io_pages > sc.swap_cluster_max)
congestion_wait(WRITE, HZ/10);

/*
Expand Down

0 comments on commit 6e5029a

Please sign in to comment.