Commit 75177faa authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] reduce CPU cost in loop

balance_dirty_pages() is too expensive to call once-per-page.  Use the
ratelimited version.
parent 5e1341d1
...@@ -238,7 +238,7 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos) ...@@ -238,7 +238,7 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos)
up(&mapping->host->i_sem); up(&mapping->host->i_sem);
out: out:
kunmap(bvec->bv_page); kunmap(bvec->bv_page);
balance_dirty_pages(mapping); balance_dirty_pages_ratelimited(mapping);
return ret; return ret;
unlock: unlock:
......
...@@ -166,7 +166,6 @@ void balance_dirty_pages(struct address_space *mapping) ...@@ -166,7 +166,6 @@ void balance_dirty_pages(struct address_space *mapping)
if (!writeback_in_progress(bdi) && ps.nr_dirty > background_thresh) if (!writeback_in_progress(bdi) && ps.nr_dirty > background_thresh)
pdflush_operation(background_writeout, 0); pdflush_operation(background_writeout, 0);
} }
EXPORT_SYMBOL_GPL(balance_dirty_pages);
/** /**
* balance_dirty_pages_ratelimited - balance dirty memory state * balance_dirty_pages_ratelimited - balance dirty memory state
...@@ -200,6 +199,7 @@ void balance_dirty_pages_ratelimited(struct address_space *mapping) ...@@ -200,6 +199,7 @@ void balance_dirty_pages_ratelimited(struct address_space *mapping)
} }
put_cpu(); put_cpu();
} }
EXPORT_SYMBOL_GPL(balance_dirty_pages_ratelimited);
/* /*
* writeback at least _min_pages, and keep writing until the amount of dirty * writeback at least _min_pages, and keep writing until the amount of dirty
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment