[BACK]Return to free_more_memory CVS log [TXT][DIR] Up to [Development] / linux-2.6-xfs / split-patches

File: [Development] / linux-2.6-xfs / split-patches / Attic / free_more_memory (download)

Revision 1.1, Thu May 20 01:54:30 2004 UTC (13 years, 5 months ago) by nathans
Branch: MAIN

Tweak and export free_more_memory routine so XFS can use it.  Allows us to interact much better with the VM in low memory situations.

Index: 2.6.x-xfs/fs/buffer.c
===================================================================
--- 2.6.x-xfs.orig/fs/buffer.c	Tue May 11 14:54:16 2004
+++ 2.6.x-xfs/fs/buffer.c	Wed May 19 13:13:40 2004
@@ -527,20 +527,22 @@
 /*
  * Kick pdflush then try to free up some ZONE_NORMAL memory.
  */
-static void free_more_memory(void)
+void free_more_memory(unsigned int gfp_mask)
 {
 	struct zone **zones;
 	pg_data_t *pgdat;
 
 	wakeup_bdflush(1024);
-	yield();
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(10);
 
 	for_each_pgdat(pgdat) {
-		zones = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones;
+		zones = pgdat->node_zonelists[gfp_mask & GFP_ZONEMASK].zones;
 		if (*zones)
-			try_to_free_pages(zones, GFP_NOFS, 0);
+			try_to_free_pages(zones, gfp_mask, 0);
 	}
 }
+EXPORT_SYMBOL(free_more_memory);
 
 /*
  * I/O completion handler for block_read_full_page() - pages
@@ -1093,7 +1095,7 @@
 	 * the reserve list is empty, we're sure there are 
 	 * async buffer heads in use.
 	 */
-	free_more_memory();
+	free_more_memory(GFP_NOFS);
 	goto try_again;
 }
 
@@ -1241,7 +1243,7 @@
 			return bh;
 
 		if (!grow_buffers(bdev, block, size))
-			free_more_memory();
+			free_more_memory(GFP_NOFS);
 	}
 }
 
Index: 2.6.x-xfs/include/linux/buffer_head.h
===================================================================
--- 2.6.x-xfs.orig/include/linux/buffer_head.h	Tue May 11 14:54:16 2004
+++ 2.6.x-xfs/include/linux/buffer_head.h	Wed May 19 13:13:40 2004
@@ -134,6 +134,7 @@
 int try_to_free_buffers(struct page *);
 void create_empty_buffers(struct page *, unsigned long,
 			unsigned long b_state);
+void free_more_memory(unsigned int gfp_mask);
 void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
 void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
 void end_buffer_async_write(struct buffer_head *bh, int uptodate);