[PATCH] Move __GFP_IO check in shrink_icache_memory to prune_icache()

From: Marcelo Tosatti (marcelo@conectiva.com.br)
Date: Mon Apr 23 2001 - 16:43:11 EST


Linus,

With the prune_icache() modifications which were integrated in pre5 there
is no more need to avoid non __GFP_IO allocations to go down to
prune_icache().

The following patch moves the __GFP_IO check down to prune_icache(),
allowing !__GFP_IO allocations to free clean unused inodes.

diff --exclude-from=/home/marcelo/exclude -Nur linux.orig/fs/dquot.c linux/fs/dquot.c
--- linux.orig/fs/dquot.c Mon Apr 23 19:15:23 2001
+++ linux/fs/dquot.c Mon Apr 23 19:18:14 2001
@@ -554,7 +554,7 @@
         if (shrink) {
                 printk(KERN_DEBUG "get_empty_dquot: pruning dcache and icache\n");
                 prune_dcache(128);
- prune_icache(128);
+ prune_icache(128, GFP_USER);
                 shrink--;
                 goto repeat;
         }
diff --exclude-from=/home/marcelo/exclude -Nur linux.orig/fs/inode.c linux/fs/inode.c
--- linux.orig/fs/inode.c Mon Apr 23 19:15:23 2001
+++ linux/fs/inode.c Mon Apr 23 19:18:04 2001
@@ -540,7 +540,7 @@
          !inode_has_buffers(inode))
 #define INODE(entry) (list_entry(entry, struct inode, i_list))
 
-void prune_icache(int goal)
+void prune_icache(int goal, int gfp_mask)
 {
         LIST_HEAD(list);
         struct list_head *entry, *freeable = &list;
@@ -577,6 +577,16 @@
 
         dispose_list(freeable);
 
+ /*
+ * Nasty deadlock avoidance..
+ *
+ * We may hold various FS locks, and we don't
+ * want to recurse into the FS that called us
+ * in clear_inode() and friends..
+ */
+ if (!(gfp_mask & __GFP_IO))
+ return;
+
         /*
          * If we freed enough clean inodes, avoid writing
          * dirty ones. Also giveup if we already tried to
@@ -596,20 +606,10 @@
 {
         int count = 0;
 
- /*
- * Nasty deadlock avoidance..
- *
- * We may hold various FS locks, and we don't
- * want to recurse into the FS that called us
- * in clear_inode() and friends..
- */
- if (!(gfp_mask & __GFP_IO))
- return;
-
         if (priority)
                 count = inodes_stat.nr_unused / priority;
 
- prune_icache(count);
+ prune_icache(count, gfp_mask);
         kmem_cache_shrink(inode_cachep);
 }
 
diff --exclude-from=/home/marcelo/exclude -Nur linux.orig/include/linux/dcache.h linux/include/linux/dcache.h
--- linux.orig/include/linux/dcache.h Mon Apr 23 19:15:23 2001
+++ linux/include/linux/dcache.h Mon Apr 23 19:18:31 2001
@@ -176,7 +176,7 @@
 
 /* icache memory management (defined in linux/fs/inode.c) */
 extern void shrink_icache_memory(int, int);
-extern void prune_icache(int);
+extern void prune_icache(int, int);
 
 /* only used at mount-time */
 extern struct dentry * d_alloc_root(struct inode *);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 23 2001 - 21:00:48 EST