Skip to contentSkip to conversation

shrink_caches inconsistancy

DISCUSSION Craig Christophel 1 participant 1 message Dec 5, 2001 VFS

lore
Share & tools
lore
#0 lore raw

locking issue with return 0; inside the lock/unlock_kernel calls. previous patch is crap. use this one instead.

Craig.

fs/dcache.c Wed Dec 5 16:13:38 2001 renamed from fs/dcache.c Sat Dec 1 17:21:03 2001 +1 -1
diff -urN linux/fs/dcache.c linux.mt/fs/dcache.c
@@ -543,7 +543,7 @@
  * too much.
  *
  * Priority:
- *   0 - very urgent: shrink everything
+ *   1 - very urgent: shrink everything
  *  ...
  *   6 - base-level: try to shrink a bit.
  */
fs/dquot.c Wed Dec 5 17:46:29 2001 renamed from fs/dquot.c Thu Nov 22 13:38:31 2001 +21 -1
diff -urN linux/fs/dquot.c linux.mt/fs/dquot.c
@@ -407,11 +407,31 @@
                head = free_dquots.prev;
        }
 }
+/*
+ * This is called from kswapd when we think we need some
+ * more memory, but aren't really sure how much. So we
+ * carefully try to free a _bit_ of our dqcache, but not
+ * too much.
+ *
+ * Priority:
+ *   1 - very urgent: shrink everything
+ *   ...
+ *   6 - base-level: try to shrink a bit.
+ */
 
 int shrink_dqcache_memory(int priority, unsigned int gfp_mask)
 {
+       int count = 0;
+
+
+       if (!(gfp_mask & __GFP_FS))
+               return 0;
+
        lock_kernel();
-       prune_dqcache(nr_free_dquots / (priority + 1));
+
+       count = nr_free_dquots / priority;
+
+       prune_dqcache(count);
        unlock_kernel();
        kmem_cache_shrink(dquot_cachep);
        return 0;
fs/inode.c Wed Dec 5 16:37:25 2001 renamed from fs/inode.c Sat Dec 1 17:21:03 2001 +11 -1
diff -urN linux/fs/inode.c linux.mt/fs/inode.c
@@ -707,7 +707,17 @@
        if (goal)
                schedule_task(&unused_inodes_flush_task);
 }
-
+/*
+ * This is called from kswapd when we think we need some
+ * more memory, but aren't really sure how much. So we
+ * carefully try to free a _bit_ of our icache, but not
+ * too much.
+ *
+ * Priority:
+ *   1 - very urgent: shrink everything
+ *  ...
+ *   6 - base-level: try to shrink a bit.
+ */
 int shrink_icache_memory(int priority, int gfp_mask)
 {
        int count = 0;