diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2008-03-24 15:29:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-03-24 22:22:19 -0400 |
commit | 4dd4b920218326231156c7991ce5b94afad841c3 (patch) | |
tree | 021d883ec96cd67f5a348eb739a5c6596fcf6d04 /mm | |
parent | 537878d2c988fa12bbfaec19ee060c7603a48230 (diff) |
revert "kswapd should only wait on IO if there is IO"
Revert commit f1a9ee758de7de1e040de849fdef46e6802ea117:
Author: Rik van Riel <riel@redhat.com>
Date: Thu Feb 7 00:14:08 2008 -0800
kswapd should only wait on IO if there is IO
The current kswapd (and try_to_free_pages) code has an oddity where the
code will wait on IO, even if there is no IO in flight. This problem is
notable especially when the system scans through many unfreeable pages,
causing unnecessary stalls in the VM.
Additionally, tasks without __GFP_FS or __GFP_IO in the direct reclaim path
will sleep if a significant number of pages are encountered that should be
written out. This gives kswapd a chance to write out those pages, while
the direct reclaim task sleeps.
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Because of large latencies and interactivity problems reported by Carlos,
here: http://lkml.org/lkml/2008/3/22/211
Cc: Rik van Riel <riel@redhat.com>
Cc: "Carlos R. Mafra" <crmafra2@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/vmscan.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 45711585684e..4046434046e6 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -70,13 +70,6 @@ struct scan_control { | |||
70 | 70 | ||
71 | int order; | 71 | int order; |
72 | 72 | ||
73 | /* | ||
74 | * Pages that have (or should have) IO pending. If we run into | ||
75 | * a lot of these, we're better off waiting a little for IO to | ||
76 | * finish rather than scanning more pages in the VM. | ||
77 | */ | ||
78 | int nr_io_pages; | ||
79 | |||
80 | /* Which cgroup do we reclaim from */ | 73 | /* Which cgroup do we reclaim from */ |
81 | struct mem_cgroup *mem_cgroup; | 74 | struct mem_cgroup *mem_cgroup; |
82 | 75 | ||
@@ -512,10 +505,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
512 | */ | 505 | */ |
513 | if (sync_writeback == PAGEOUT_IO_SYNC && may_enter_fs) | 506 | if (sync_writeback == PAGEOUT_IO_SYNC && may_enter_fs) |
514 | wait_on_page_writeback(page); | 507 | wait_on_page_writeback(page); |
515 | else { | 508 | else |
516 | sc->nr_io_pages++; | ||
517 | goto keep_locked; | 509 | goto keep_locked; |
518 | } | ||
519 | } | 510 | } |
520 | 511 | ||
521 | referenced = page_referenced(page, 1, sc->mem_cgroup); | 512 | referenced = page_referenced(page, 1, sc->mem_cgroup); |
@@ -554,10 +545,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
554 | if (PageDirty(page)) { | 545 | if (PageDirty(page)) { |
555 | if (sc->order <= PAGE_ALLOC_COSTLY_ORDER && referenced) | 546 | if (sc->order <= PAGE_ALLOC_COSTLY_ORDER && referenced) |
556 | goto keep_locked; | 547 | goto keep_locked; |
557 | if (!may_enter_fs) { | 548 | if (!may_enter_fs) |
558 | sc->nr_io_pages++; | ||
559 | goto keep_locked; | 549 | goto keep_locked; |
560 | } | ||
561 | if (!sc->may_writepage) | 550 | if (!sc->may_writepage) |
562 | goto keep_locked; | 551 | goto keep_locked; |
563 | 552 | ||
@@ -568,10 +557,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
568 | case PAGE_ACTIVATE: | 557 | case PAGE_ACTIVATE: |
569 | goto activate_locked; | 558 | goto activate_locked; |
570 | case PAGE_SUCCESS: | 559 | case PAGE_SUCCESS: |
571 | if (PageWriteback(page) || PageDirty(page)) { | 560 | if (PageWriteback(page) || PageDirty(page)) |
572 | sc->nr_io_pages++; | ||
573 | goto keep; | 561 | goto keep; |
574 | } | ||
575 | /* | 562 | /* |
576 | * A synchronous write - probably a ramdisk. Go | 563 | * A synchronous write - probably a ramdisk. Go |
577 | * ahead and try to reclaim the page. | 564 | * ahead and try to reclaim the page. |
@@ -1344,7 +1331,6 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask, | |||
1344 | 1331 | ||
1345 | for (priority = DEF_PRIORITY; priority >= 0; priority--) { | 1332 | for (priority = DEF_PRIORITY; priority >= 0; priority--) { |
1346 | sc->nr_scanned = 0; | 1333 | sc->nr_scanned = 0; |
1347 | sc->nr_io_pages = 0; | ||
1348 | if (!priority) | 1334 | if (!priority) |
1349 | disable_swap_token(); | 1335 | disable_swap_token(); |
1350 | nr_reclaimed += shrink_zones(priority, zones, sc); | 1336 | nr_reclaimed += shrink_zones(priority, zones, sc); |
@@ -1379,8 +1365,7 @@ static unsigned long do_try_to_free_pages(struct zone **zones, gfp_t gfp_mask, | |||
1379 | } | 1365 | } |
1380 | 1366 | ||
1381 | /* Take a nap, wait for some writeback to complete */ | 1367 | /* Take a nap, wait for some writeback to complete */ |
1382 | if (sc->nr_scanned && priority < DEF_PRIORITY - 2 && | 1368 | if (sc->nr_scanned && priority < DEF_PRIORITY - 2) |
1383 | sc->nr_io_pages > sc->swap_cluster_max) | ||
1384 | congestion_wait(WRITE, HZ/10); | 1369 | congestion_wait(WRITE, HZ/10); |
1385 | } | 1370 | } |
1386 | /* top priority shrink_caches still had more to do? don't OOM, then */ | 1371 | /* top priority shrink_caches still had more to do? don't OOM, then */ |
@@ -1514,7 +1499,6 @@ loop_again: | |||
1514 | if (!priority) | 1499 | if (!priority) |
1515 | disable_swap_token(); | 1500 | disable_swap_token(); |
1516 | 1501 | ||
1517 | sc.nr_io_pages = 0; | ||
1518 | all_zones_ok = 1; | 1502 | all_zones_ok = 1; |
1519 | 1503 | ||
1520 | /* | 1504 | /* |
@@ -1607,8 +1591,7 @@ loop_again: | |||
1607 | * OK, kswapd is getting into trouble. Take a nap, then take | 1591 | * OK, kswapd is getting into trouble. Take a nap, then take |
1608 | * another pass across the zones. | 1592 | * another pass across the zones. |
1609 | */ | 1593 | */ |
1610 | if (total_scanned && priority < DEF_PRIORITY - 2 && | 1594 | if (total_scanned && priority < DEF_PRIORITY - 2) |
1611 | sc.nr_io_pages > sc.swap_cluster_max) | ||
1612 | congestion_wait(WRITE, HZ/10); | 1595 | congestion_wait(WRITE, HZ/10); |
1613 | 1596 | ||
1614 | /* | 1597 | /* |