* [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory
@ 2009-07-14 14:22 Mike Frysinger
2009-07-14 14:30 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-07-14 14:22 UTC (permalink / raw)
To: linux-kernel; +Cc: uclinux-dist-devel, Sonic Zhang, David Howells
From: Sonic Zhang <sonic.zhang@analog.com>
Since no-mmu systems tend to be memory constrained, we want to drop all
of the page cache whenever memory gets low. The only other option is to
invoke the oom killer, and clearly that's not ideal.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: David Howells <dhowells@redhat.com>
---
fs/drop_caches.c | 2 +-
include/linux/mm.h | 1 +
mm/page_alloc.c | 4 ++++
3 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index a2edb79..51f097d 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -33,7 +33,7 @@ static void drop_pagecache_sb(struct super_block *sb)
iput(toput_inode);
}
-static void drop_pagecache(void)
+void drop_pagecache(void)
{
struct super_block *sb;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ba3a7cb..46084c4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1293,6 +1293,7 @@ int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
void __user *, size_t *, loff_t *);
unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
unsigned long lru_pages);
+void drop_pagecache(void);
#ifndef CONFIG_MMU
#define randomize_va_space 0
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index caa9268..246d381 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1772,6 +1772,10 @@ restart:
goto got_pg;
rebalance:
+#ifndef CONFIG_MMU
+ drop_pagecache();
+#endif
+
/* Allocate without watermarks if the context allows */
if (alloc_flags & ALLOC_NO_WATERMARKS) {
page = __alloc_pages_high_priority(gfp_mask, order,
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory
2009-07-14 14:22 [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory Mike Frysinger
@ 2009-07-14 14:30 ` Peter Zijlstra
2009-07-15 3:29 ` Zhang, Sonic
0 siblings, 1 reply; 4+ messages in thread
From: Peter Zijlstra @ 2009-07-14 14:30 UTC (permalink / raw)
To: Mike Frysinger
Cc: linux-kernel, uclinux-dist-devel, Sonic Zhang, David Howells
On Tue, 2009-07-14 at 10:22 -0400, Mike Frysinger wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
>
> Since no-mmu systems tend to be memory constrained, we want to drop all
> of the page cache whenever memory gets low. The only other option is to
> invoke the oom killer, and clearly that's not ideal.
Uhm,.. normally reclaim will already try to drop pagecache.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory
2009-07-14 14:30 ` Peter Zijlstra
@ 2009-07-15 3:29 ` Zhang, Sonic
2009-07-15 6:38 ` Peter Zijlstra
0 siblings, 1 reply; 4+ messages in thread
From: Zhang, Sonic @ 2009-07-15 3:29 UTC (permalink / raw)
To: Peter Zijlstra, Mike Frysinger
Cc: linux-kernel, uclinux-dist-devel, David Howells
The reclaim is not that aggressive.
Sonic
-----Original Message-----
From: Peter Zijlstra [mailto:peterz@infradead.org]
Sent: Tuesday, July 14, 2009 10:31 PM
To: Mike Frysinger
Cc: linux-kernel@vger.kernel.org;
uclinux-dist-devel@blackfin.uclinux.org; Zhang, Sonic; David Howells
Subject: Re: [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails
due to low memory
On Tue, 2009-07-14 at 10:22 -0400, Mike Frysinger wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
>
> Since no-mmu systems tend to be memory constrained, we want to drop
> all of the page cache whenever memory gets low. The only other option
> is to invoke the oom killer, and clearly that's not ideal.
Uhm,.. normally reclaim will already try to drop pagecache.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory
2009-07-15 3:29 ` Zhang, Sonic
@ 2009-07-15 6:38 ` Peter Zijlstra
0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2009-07-15 6:38 UTC (permalink / raw)
To: Zhang, Sonic
Cc: Mike Frysinger, linux-kernel, uclinux-dist-devel, David Howells
Please don't top post.
On Wed, 2009-07-15 at 11:29 +0800, Zhang, Sonic wrote:
> From: Peter Zijlstra [mailto:peterz@infradead.org]
> > Sent: Tuesday, July 14, 2009 10:31 PM
> > To: Mike Frysinger
> > Cc: linux-kernel@vger.kernel.org;
> > uclinux-dist-devel@blackfin.uclinux.org; Zhang, Sonic; David Howells
> > Subject: Re: [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails
> > due to low memory
> >
> > On Tue, 2009-07-14 at 10:22 -0400, Mike Frysinger wrote:
> > > From: Sonic Zhang <sonic.zhang@analog.com>
> > >
> > > Since no-mmu systems tend to be memory constrained, we want to drop
> > > all of the page cache whenever memory gets low. The only other option
> >
> > > is to invoke the oom killer, and clearly that's not ideal.
> >
> > Uhm,.. normally reclaim will already try to drop pagecache.
> The reclaim is not that aggressive.
Well, then maybe we should fix that instead?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-15 6:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 14:22 [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory Mike Frysinger
2009-07-14 14:30 ` Peter Zijlstra
2009-07-15 3:29 ` Zhang, Sonic
2009-07-15 6:38 ` Peter Zijlstra
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.