All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NOMMU: Pages allocated to a ramfs inode's pagecache may get wrongly discarded
@ 2009-03-11 15:30 David Howells
  2009-03-11 17:26 ` Johannes Weiner
                   ` (3 more replies)
  0 siblings, 4 replies; 101+ messages in thread
From: David Howells @ 2009-03-11 15:30 UTC (permalink / raw)
  To: torvalds, akpm, peterz; +Cc: Enrik.Berkhan, dhowells, uclinux-dev, linux-kernel

From: Enrik Berkhan <Enrik.Berkhan@ge.com>

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 <Enrik.Berkhan@ge.com>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/ramfs/file-nommu.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index b9b567a..90d72be 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -114,6 +114,9 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
 		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);
 	}
 


^ permalink raw reply related	[flat|nested] 101+ messages in thread

end of thread, other threads:[~2009-03-26 10:38 UTC | newest]

Thread overview: 101+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-11 15:30 [PATCH] NOMMU: Pages allocated to a ramfs inode's pagecache may get wrongly discarded David Howells
2009-03-11 17:26 ` Johannes Weiner
2009-03-11 22:03 ` Andrew Morton
2009-03-11 22:03   ` Andrew Morton
2009-03-11 22:36   ` Johannes Weiner
2009-03-11 22:36     ` Johannes Weiner
2009-03-12  0:02   ` Andrew Morton
2009-03-12  0:02     ` Andrew Morton
2009-03-12  0:35     ` Minchan Kim
2009-03-12  0:35       ` Minchan Kim
2009-03-12  1:04       ` KOSAKI Motohiro
2009-03-12  1:04         ` KOSAKI Motohiro
2009-03-12  1:52         ` Minchan Kim
2009-03-12  1:52           ` Minchan Kim
2009-03-12  1:56           ` Minchan Kim
2009-03-12  1:56             ` Minchan Kim
2009-03-12  2:00           ` KOSAKI Motohiro
2009-03-12  2:00             ` KOSAKI Motohiro
2009-03-12  2:11             ` Minchan Kim
2009-03-12  2:11               ` Minchan Kim
2009-03-12 12:19         ` Robin Getz
2009-03-12 12:19           ` Robin Getz
2009-03-12 17:55           ` [uClinux-dev] " Jamie Lokier
2009-03-12 17:55             ` Jamie Lokier
2009-03-13 17:33         ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU David Howells
2009-03-13 17:33           ` David Howells
2009-03-13 17:33           ` [PATCH 1/2] NOMMU: There is no mlock() for NOMMU, so don't provide the bits David Howells
2009-03-13 17:33             ` David Howells
2009-03-14 11:17             ` KOSAKI Motohiro
2009-03-14 11:17               ` KOSAKI Motohiro
2009-03-13 17:33           ` [PATCH 2/2] NOMMU: Make CONFIG_UNEVICTABLE_LRU available when CONFIG_MMU=n David Howells
2009-03-13 17:33             ` David Howells
2009-03-14 11:17             ` KOSAKI Motohiro
2009-03-14 11:17               ` KOSAKI Motohiro
2009-03-14  0:27           ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU Minchan Kim
2009-03-14  0:27             ` Minchan Kim
2009-03-20 16:08             ` Lee Schermerhorn
2009-03-20 16:08               ` Lee Schermerhorn
2009-03-20 16:24             ` David Howells
2009-03-20 16:24               ` David Howells
2009-03-20 18:30               ` Lee Schermerhorn
2009-03-20 18:30                 ` Lee Schermerhorn
2009-03-21 10:20                 ` Johannes Weiner
2009-03-21 10:20                   ` Johannes Weiner
2009-03-22 20:13                   ` [patch 1/3] mm: decouple unevictable lru from mmu Johannes Weiner
2009-03-22 20:13                     ` Johannes Weiner
2009-03-22 23:46                     ` KOSAKI Motohiro
2009-03-22 23:46                       ` KOSAKI Motohiro
2009-03-23  0:14                       ` Johannes Weiner
2009-03-23  0:14                         ` Johannes Weiner
2009-03-23 10:48                       ` David Howells
2009-03-23 10:48                         ` David Howells
2009-03-22 20:13                   ` [patch 2/3] ramfs-nommu: use generic lru cache Johannes Weiner
2009-03-22 20:13                     ` Johannes Weiner
2009-03-23  2:22                     ` KOSAKI Motohiro
2009-03-23  2:22                       ` KOSAKI Motohiro
2009-03-22 20:13                   ` [patch 3/3] mm: keep pages from unevictable mappings off the LRU lists Johannes Weiner
2009-03-22 20:13                     ` Johannes Weiner
2009-03-23  0:44                     ` Minchan Kim
2009-03-23  0:44                       ` Minchan Kim
2009-03-23  2:21                       ` KOSAKI Motohiro
2009-03-23  2:21                         ` KOSAKI Motohiro
2009-03-23  8:42                         ` Johannes Weiner
2009-03-23  8:42                           ` Johannes Weiner
2009-03-23  9:01                           ` KOSAKI Motohiro
2009-03-23  9:01                             ` KOSAKI Motohiro
2009-03-23  9:23                             ` KOSAKI Motohiro
2009-03-23  9:23                               ` KOSAKI Motohiro
2009-03-26  0:48                               ` Johannes Weiner
2009-03-26  0:48                                 ` Johannes Weiner
2009-03-23 10:40                   ` [patch 2/3] ramfs-nommu: use generic lru cache David Howells
2009-03-23 10:40                     ` David Howells
2009-03-23 10:53                   ` [patch 3/3] mm: keep pages from unevictable mappings off the LRU lists David Howells
2009-03-23 10:53                     ` David Howells
2009-03-26  0:01                     ` Johannes Weiner
2009-03-26  0:01                       ` Johannes Weiner
2009-03-26  8:56                       ` KOSAKI Motohiro
2009-03-26  8:56                         ` KOSAKI Motohiro
2009-03-26 10:36                         ` Johannes Weiner
2009-03-26 10:36                           ` Johannes Weiner
2009-03-23 20:07                   ` [PATCH 0/2] Make the Unevictable LRU available on NOMMU Lee Schermerhorn
2009-03-23 20:07                     ` Lee Schermerhorn
2009-03-13 11:53       ` [PATCH] NOMMU: Pages allocated to a ramfs inode's pagecache may get wrongly discarded David Howells
2009-03-13 11:53         ` David Howells
2009-03-13 22:49         ` Johannes Weiner
2009-03-13 22:49           ` Johannes Weiner
2009-03-12  0:08 ` Andrew Morton
2009-03-12  7:12   ` Berkhan, Enrik (GE Infra, Oil & Gas)
2009-03-12 11:29     ` [uClinux-dev] " Jamie Lokier
2009-03-12 11:50       ` Peter Zijlstra
2009-03-12 23:20         ` Minchan Kim
2009-03-13  7:56           ` Peter Zijlstra
2009-03-13  9:17             ` Minchan Kim
2009-03-12 12:25 ` David Howells
2009-03-12 19:43   ` Andrew Morton
2009-03-13  2:03     ` KOSAKI Motohiro
2009-03-13  7:57       ` Peter Zijlstra
2009-03-13  8:15         ` KOSAKI Motohiro
2009-03-13  9:19           ` Minchan Kim
2009-03-13 10:44           ` Johannes Weiner
2009-03-14 14:29             ` KOSAKI Motohiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.