aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-07-09 08:52:32 -0400
committerJens Axboe <axboe@carl.(none)>2009-07-10 14:31:53 -0400
commit8aa7e847d834ed937a9ad37a0f2ad5b8584c1ab0 (patch)
tree76c8b4f1362a928d426f2201790ab5d128f57724 /mm
parentc2cc49a2f8a479dde96a599646d30b6cc9dbed78 (diff)
Fix congestion_wait() sync/async vs read/write confusion
Commit 1faa16d22877f4839bd433547d770c676d1d964c accidentally broke the bdi congestion wait queue logic, causing us to wait on congestion for WRITE (== 1) when we really wanted BLK_RW_ASYNC (== 0) instead. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/backing-dev.c7
-rw-r--r--mm/memcontrol.c2
-rw-r--r--mm/page-writeback.c8
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/vmscan.c8
5 files changed, 14 insertions, 15 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 493b468a5035..c86edd244294 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -283,7 +283,6 @@ static wait_queue_head_t congestion_wqh[2] = {
283 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) 283 __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
284 }; 284 };
285 285
286
287void clear_bdi_congested(struct backing_dev_info *bdi, int sync) 286void clear_bdi_congested(struct backing_dev_info *bdi, int sync)
288{ 287{
289 enum bdi_state bit; 288 enum bdi_state bit;
@@ -308,18 +307,18 @@ EXPORT_SYMBOL(set_bdi_congested);
308 307
309/** 308/**
310 * congestion_wait - wait for a backing_dev to become uncongested 309 * congestion_wait - wait for a backing_dev to become uncongested
311 * @rw: READ or WRITE 310 * @sync: SYNC or ASYNC IO
312 * @timeout: timeout in jiffies 311 * @timeout: timeout in jiffies
313 * 312 *
314 * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit 313 * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit
315 * write congestion. If no backing_devs are congested then just wait for the 314 * write congestion. If no backing_devs are congested then just wait for the
316 * next write to be completed. 315 * next write to be completed.
317 */ 316 */
318long congestion_wait(int rw, long timeout) 317long congestion_wait(int sync, long timeout)
319{ 318{
320 long ret; 319 long ret;
321 DEFINE_WAIT(wait); 320 DEFINE_WAIT(wait);
322 wait_queue_head_t *wqh = &congestion_wqh[rw]; 321 wait_queue_head_t *wqh = &congestion_wqh[sync];
323 322
324 prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); 323 prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
325 ret = io_schedule_timeout(timeout); 324 ret = io_schedule_timeout(timeout);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e2fa20dadf40..e717964cb5a0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1973,7 +1973,7 @@ try_to_free:
1973 if (!progress) { 1973 if (!progress) {
1974 nr_retries--; 1974 nr_retries--;
1975 /* maybe some writeback is necessary */ 1975 /* maybe some writeback is necessary */
1976 congestion_wait(WRITE, HZ/10); 1976 congestion_wait(BLK_RW_ASYNC, HZ/10);
1977 } 1977 }
1978 1978
1979 } 1979 }
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 7687879253b9..81627ebcd313 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -575,7 +575,7 @@ static void balance_dirty_pages(struct address_space *mapping)
575 if (pages_written >= write_chunk) 575 if (pages_written >= write_chunk)
576 break; /* We've done our duty */ 576 break; /* We've done our duty */
577 577
578 congestion_wait(WRITE, HZ/10); 578 congestion_wait(BLK_RW_ASYNC, HZ/10);
579 } 579 }
580 580
581 if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh && 581 if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh &&
@@ -669,7 +669,7 @@ void throttle_vm_writeout(gfp_t gfp_mask)
669 if (global_page_state(NR_UNSTABLE_NFS) + 669 if (global_page_state(NR_UNSTABLE_NFS) +
670 global_page_state(NR_WRITEBACK) <= dirty_thresh) 670 global_page_state(NR_WRITEBACK) <= dirty_thresh)
671 break; 671 break;
672 congestion_wait(WRITE, HZ/10); 672 congestion_wait(BLK_RW_ASYNC, HZ/10);
673 673
674 /* 674 /*
675 * The caller might hold locks which can prevent IO completion 675 * The caller might hold locks which can prevent IO completion
@@ -715,7 +715,7 @@ static void background_writeout(unsigned long _min_pages)
715 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { 715 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) {
716 /* Wrote less than expected */ 716 /* Wrote less than expected */
717 if (wbc.encountered_congestion || wbc.more_io) 717 if (wbc.encountered_congestion || wbc.more_io)
718 congestion_wait(WRITE, HZ/10); 718 congestion_wait(BLK_RW_ASYNC, HZ/10);
719 else 719 else
720 break; 720 break;
721 } 721 }
@@ -787,7 +787,7 @@ static void wb_kupdate(unsigned long arg)
787 writeback_inodes(&wbc); 787 writeback_inodes(&wbc);
788 if (wbc.nr_to_write > 0) { 788 if (wbc.nr_to_write > 0) {
789 if (wbc.encountered_congestion || wbc.more_io) 789 if (wbc.encountered_congestion || wbc.more_io)
790 congestion_wait(WRITE, HZ/10); 790 congestion_wait(BLK_RW_ASYNC, HZ/10);
791 else 791 else
792 break; /* All the old data is written */ 792 break; /* All the old data is written */
793 } 793 }
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ad7cd1c56b07..a35eeab2724c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1666,7 +1666,7 @@ __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order,
1666 preferred_zone, migratetype); 1666 preferred_zone, migratetype);
1667 1667
1668 if (!page && gfp_mask & __GFP_NOFAIL) 1668 if (!page && gfp_mask & __GFP_NOFAIL)
1669 congestion_wait(WRITE, HZ/50); 1669 congestion_wait(BLK_RW_ASYNC, HZ/50);
1670 } while (!page && (gfp_mask & __GFP_NOFAIL)); 1670 } while (!page && (gfp_mask & __GFP_NOFAIL));
1671 1671
1672 return page; 1672 return page;
@@ -1831,7 +1831,7 @@ rebalance:
1831 pages_reclaimed += did_some_progress; 1831 pages_reclaimed += did_some_progress;
1832 if (should_alloc_retry(gfp_mask, order, pages_reclaimed)) { 1832 if (should_alloc_retry(gfp_mask, order, pages_reclaimed)) {
1833 /* Wait for some write requests to complete then retry */ 1833 /* Wait for some write requests to complete then retry */
1834 congestion_wait(WRITE, HZ/50); 1834 congestion_wait(BLK_RW_ASYNC, HZ/50);
1835 goto rebalance; 1835 goto rebalance;
1836 } 1836 }
1837 1837
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 54155268dfca..dea7abd31098 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1104,7 +1104,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
1104 */ 1104 */
1105 if (nr_freed < nr_taken && !current_is_kswapd() && 1105 if (nr_freed < nr_taken && !current_is_kswapd() &&
1106 lumpy_reclaim) { 1106 lumpy_reclaim) {
1107 congestion_wait(WRITE, HZ/10); 1107 congestion_wait(BLK_RW_ASYNC, HZ/10);
1108 1108
1109 /* 1109 /*
1110 * The attempt at page out may have made some 1110 * The attempt at page out may have made some
@@ -1721,7 +1721,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
1721 1721
1722 /* Take a nap, wait for some writeback to complete */ 1722 /* Take a nap, wait for some writeback to complete */
1723 if (sc->nr_scanned && priority < DEF_PRIORITY - 2) 1723 if (sc->nr_scanned && priority < DEF_PRIORITY - 2)
1724 congestion_wait(WRITE, HZ/10); 1724 congestion_wait(BLK_RW_ASYNC, HZ/10);
1725 } 1725 }
1726 /* top priority shrink_zones still had more to do? don't OOM, then */ 1726 /* top priority shrink_zones still had more to do? don't OOM, then */
1727 if (!sc->all_unreclaimable && scanning_global_lru(sc)) 1727 if (!sc->all_unreclaimable && scanning_global_lru(sc))
@@ -1960,7 +1960,7 @@ loop_again:
1960 * another pass across the zones. 1960 * another pass across the zones.
1961 */ 1961 */
1962 if (total_scanned && priority < DEF_PRIORITY - 2) 1962 if (total_scanned && priority < DEF_PRIORITY - 2)
1963 congestion_wait(WRITE, HZ/10); 1963 congestion_wait(BLK_RW_ASYNC, HZ/10);
1964 1964
1965 /* 1965 /*
1966 * We do this so kswapd doesn't build up large priorities for 1966 * We do this so kswapd doesn't build up large priorities for
@@ -2233,7 +2233,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
2233 goto out; 2233 goto out;
2234 2234
2235 if (sc.nr_scanned && prio < DEF_PRIORITY - 2) 2235 if (sc.nr_scanned && prio < DEF_PRIORITY - 2)
2236 congestion_wait(WRITE, HZ / 10); 2236 congestion_wait(BLK_RW_ASYNC, HZ / 10);
2237 } 2237 }
2238 } 2238 }
2239 2239