Title: [6193] trunk/fs/ramfs/file-nommu.c: apply mainline commit 020fe22ff14320927f394de222cbb11708bcc7a8
- Revision
- 6193
- Author
- vapier
- Date
- 2009-03-17 08:57:54 -0500 (Tue, 17 Mar 2009)
Log Message
apply mainline commit 020fe22ff14320927f394de222cbb11708bcc7a8
Author: Enrik Berkhan <[email protected]>
Date: Fri Mar 13 13:51:56 2009 -0700
nommu: ramfs: pages allocated to an inode's pagecache may get wrongly discarded
The pages attached to a ramfs inode's pagecache by truncation from nothing
- as done by SYSV SHM for example - may get discarded under memory
pressure.
The problem is that the pages are not marked dirty. Anything that creates
data in an MMU-based ramfs will cause the pages holding that data will
cause the set_page_dirty() aop to be called.
For the NOMMU-based mmap, set_page_dirty() may be called by write(), but
it won't be called by page-writing faults on writable mmaps, and it isn't
called by ramfs_nommu_expand_for_mapping() when a file is being truncated
from nothing to allocate a contiguous run.
The solution is to mark the pages dirty at the point of allocation by the
truncation code.
Signed-off-by: Enrik Berkhan <[email protected]>
Signed-off-by: David Howells <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Johannes Weiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Modified Paths
Diff
Modified: trunk/fs/ramfs/file-nommu.c (6192 => 6193)
--- trunk/fs/ramfs/file-nommu.c 2009-03-17 13:43:26 UTC (rev 6192)
+++ trunk/fs/ramfs/file-nommu.c 2009-03-17 13:57:54 UTC (rev 6193)
@@ -114,6 +114,9 @@
if (!pagevec_add(&lru_pvec, page))
__pagevec_lru_add_file(&lru_pvec);
+ /* prevent the page from being discarded on memory pressure */
+ SetPageDirty(page);
+
unlock_page(page);
}
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits