Skip to contentSkip to conversation

NOMMU: drop page cache whenever any alloc fails due to low memory

PATCH/RFC Mike Frysinger 3 participants 4 messages Jul 14, 2009 – Jul 15, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

From: Sonic Zhang <[email protected]>

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.

---
 fs/drop_caches.c   |    2 +-
 include/linux/mm.h |    1 +
 mm/page_alloc.c    |    4 ++++
 3 files changed, 6 insertions(+), 1 deletions(-)
fs/drop_caches.c +1 -1
index a2edb79..51f097d 100644
@@ -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;
 
include/linux/mm.h +1 -0
index ba3a7cb..46084c4 100644
@@ -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
mm/page_alloc.c +4 -0
index caa9268..246d381 100644
@@ -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,
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 5 lines · Mike Frysinger

From: Sonic Zhang <[email protected]>

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.

#2 lore raw

The reclaim is not that aggressive.

Sonic

-----Original Message-----
From: Peter Zijlstra [mailto:[email protected]]
Sent: Tuesday, July 14, 2009 10:31 PM
To: Mike Frysinger
Cc: [email protected]; [email protected]; Zhang, Sonic; David Howells
Subject: Re: [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory

Quoted 6 lines · Mike Frysinger

From: Sonic Zhang <[email protected]>

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.

#3 lore raw

Please don't top post.

Quoted 11 lines · Sonic

From: Peter Zijlstra [mailto:[email protected]]

Quoted 10 lines

Sent: Tuesday, July 14, 2009 10:31 PM
To: Mike Frysinger
Cc: [email protected]; [email protected]; Zhang, Sonic; David Howells
Subject: Re: [PATCH/RFC] NOMMU: drop page cache whenever any alloc fails due to low memory

Quoted 2 lines · Mike Frysinger

From: Sonic Zhang <[email protected]>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

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?