Add balance_dirty_pages_ratelimited() to cont_expand_zero()
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Mon, 28 Apr 2008 09:16:28 +0000 (02:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:47 +0000 (08:58 -0700)
On the systems, ftruncate() which expand size for FAT became the cause
of OOM.  The cont_expand_zero() filled all memory with dirty pages,
and since disk is very slow, limit of page scanning was exceeded, then
it triggered OOM.

This adds balance_dirty_pages_ratelimited() to avoid filling memory
with dirty pages.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/buffer.c

index 7d51e64..3db4a26 100644 (file)
@@ -2246,6 +2246,8 @@ int cont_expand_zero(struct file *file, struct address_space *mapping,
                        goto out;
                BUG_ON(err != len);
                err = 0;
+
+               balance_dirty_pages_ratelimited(mapping);
        }
 
        /* page covers the boundary, find the boundary offset */