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

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

Revision 1.1, Thu May 20 01:38:55 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, especially in combination with the cache_defs patch.

Index: 2.4.x-xfs/fs/buffer.c
===================================================================
--- 2.4.x-xfs.orig/fs/buffer.c	Wed May 19 13:23:04 2004
+++ 2.4.x-xfs/fs/buffer.c	Wed May 19 13:30:28 2004
@@ -785,14 +785,16 @@
 	}
 }
 
-static void free_more_memory(void)
+void free_more_memory(unsigned int gfp_mask)
 {
 	balance_dirty();
 	wakeup_bdflush();
-	try_to_free_pages(GFP_NOIO);
+	set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(10);
+	try_to_free_pages(gfp_mask);
 	run_task_queue(&tq_disk);
-	yield();
 }
+EXPORT_SYMBOL(free_more_memory);
 
 void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
 {
@@ -1021,7 +1023,7 @@
 		}
 
 		if (!grow_buffers(dev, block, size))
-			free_more_memory();
+			free_more_memory(GFP_NOIO);
 	}
 }
 
@@ -1363,7 +1365,7 @@
 	 */
 	run_task_queue(&tq_disk);
 
-	free_more_memory();
+	free_more_memory(GFP_NOIO);
 	goto try_again;
 }
 
Index: 2.4.x-xfs/include/linux/fs.h
===================================================================
--- 2.4.x-xfs.orig/include/linux/fs.h	Wed May 19 13:23:04 2004
+++ 2.4.x-xfs/include/linux/fs.h	Wed May 19 13:30:47 2004
@@ -1492,6 +1492,7 @@
 }
 extern void wakeup_bdflush(void);
 extern void wakeup_kupdate(void);
+extern void free_more_memory(unsigned int gfp_mask);
 extern void put_unused_buffer_head(struct buffer_head * bh);
 extern struct buffer_head * get_unused_buffer_head(int async);
 extern int block_dump;