summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c6
-rw-r--r--mm/vmscan.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 5efa9aaf7..51624abcf 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -127,7 +127,7 @@ repeat:
goto repeat;
}
if (page_count(page) != 2)
- printk("hm, busy page invalidated? (not necesserily a bug)\n");
+ printk("hm, busy page invalidated? (not necessarily a bug)\n");
lru_cache_del(page);
remove_page_from_inode_queue(page);
@@ -912,6 +912,8 @@ static void generic_file_readahead(int reada_ok,
ahead = 0;
while (ahead < max_ahead) {
ahead += PAGE_CACHE_SIZE;
+ if ((raend + ahead) >= inode->i_size)
+ break;
page_cache_read(filp, raend + ahead);
}
/*
@@ -1779,6 +1781,7 @@ generic_file_write(struct file *file, const char *buf,
long status;
int err;
+ down(&inode->i_sem);
err = file->f_error;
if (err) {
file->f_error = 0;
@@ -1872,6 +1875,7 @@ repeat_find:
err = written ? written : status;
out:
+ up(&inode->i_sem);
return err;
}
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 8ee000fc0..1ce37062b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -424,6 +424,14 @@ static int do_try_to_free_pages(unsigned int gfp_mask)
goto done;
}
+ /* don't be too light against the d/i cache since
+ shrink_mmap() almost never fail when there's
+ really plenty of memory free. */
+ count -= shrink_dcache_memory(priority, gfp_mask);
+ count -= shrink_icache_memory(priority, gfp_mask);
+ if (count <= 0)
+ goto done;
+
/* Try to get rid of some shared memory pages.. */
if (gfp_mask & __GFP_IO) {
while (shm_swap(priority, gfp_mask)) {
@@ -437,8 +445,6 @@ static int do_try_to_free_pages(unsigned int gfp_mask)
if (!--count)
goto done;
}
-
- shrink_dcache_memory(priority, gfp_mask);
} while (--priority >= 0);
done: