Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 166332
b: refs/heads/master
c: 3a2e9a5
h: refs/heads/master
v: v3
  • Loading branch information
Wu Fengguang authored and Jens Axboe committed Sep 25, 2009
1 parent 8714d00 commit f985d64
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 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: a5989bdc981ec85e0734ac22519cc0b780813d7b
refs/heads/master: 3a2e9a5a2afc1a2d2c548b8987f133235cebe933
16 changes: 10 additions & 6 deletions trunk/mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ static long ratelimit_pages = 32;
/*
* When balance_dirty_pages decides that the caller needs to perform some
* non-background writeback, this is how many pages it will attempt to write.
* It should be somewhat larger than RATELIMIT_PAGES to ensure that reasonably
* It should be somewhat larger than dirtied pages to ensure that reasonably
* large amounts of I/O are submitted.
*/
static inline long sync_writeback_pages(void)
static inline long sync_writeback_pages(unsigned long dirtied)
{
return ratelimit_pages + ratelimit_pages / 2;
if (dirtied < ratelimit_pages)
dirtied = ratelimit_pages;

return dirtied + dirtied / 2;
}

/* The following parameters are exported via /proc/sys/vm */
Expand Down Expand Up @@ -477,15 +480,15 @@ get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
* If we're over `background_thresh' then pdflush is woken to perform some
* writeout.
*/
static void balance_dirty_pages(struct address_space *mapping)
static void balance_dirty_pages(struct address_space *mapping,
unsigned long write_chunk)
{
long nr_reclaimable, bdi_nr_reclaimable;
long nr_writeback, bdi_nr_writeback;
unsigned long background_thresh;
unsigned long dirty_thresh;
unsigned long bdi_thresh;
unsigned long pages_written = 0;
unsigned long write_chunk = sync_writeback_pages();
unsigned long pause = 1;

struct backing_dev_info *bdi = mapping->backing_dev_info;
Expand Down Expand Up @@ -640,9 +643,10 @@ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
p = &__get_cpu_var(bdp_ratelimits);
*p += nr_pages_dirtied;
if (unlikely(*p >= ratelimit)) {
ratelimit = sync_writeback_pages(*p);
*p = 0;
preempt_enable();
balance_dirty_pages(mapping);
balance_dirty_pages(mapping, ratelimit);
return;
}
preempt_enable();
Expand Down

0 comments on commit f985d64

Please sign in to comment.